var foo = 2;
if (true) {
var bar = 1;
}will be compiled to
| // See https://www.marcveens.nl/netlify-cms-generate-config-yml | |
| // https://www.netlifycms.org/docs/configuration-options/ | |
| type PublishMode = 'simple' | 'editorial_workflow'; | |
| type ExtensionType = 'yml' | 'yaml' | 'toml' | 'json' | 'md' | 'markdown' | 'html'; | |
| type FormatType = 'yml' | 'yaml' | 'toml' | 'json' | 'frontmatter' | 'yaml-frontmatter' | 'toml-frontmatter' | 'json-frontmatter'; | |
| type WidgetType = 'boolean' | 'date' | 'datetime' | 'file' | 'hidden' | 'image' | |
| | 'list' | 'map' | 'markdown' | 'number' | 'object' | 'relation' | |
| | 'select' | 'string' | 'text' | string; | |
| type MapType = 'Point' | 'LineString' | 'Polygon'; |
Based on Practical Design Patterns in Javascript.
These patterns deal with the creation of new instances of an object
| <!DOCTYPE> | |
| <html> | |
| <head> | |
| <script src="lodash.min.js"></script> | |
| </head> | |
| <body> | |
| <div class="js-player"></div> |
| ;(function () { | |
| function utils() { } | |
| utils.prototype.customString = function(str) { | |
| this.value = str; | |
| return this; | |
| }; | |
| utils.prototype.toLower = function() { | |
| this.value = this.value.toLowerCase(); |
| <!DOCTYPE> | |
| <html> | |
| <head> | |
| <style> | |
| body { | |
| height: 4000px; | |
| } | |
| .fixed { |
| (function ($) { | |
| 'use strict'; | |
| function Maps($root, options) { | |
| this.options = options; | |
| this.$root = $root; | |
| this.map = null; | |
| this.markerCluster = null; | |
| this.infoWindow = null; | |
| this.markers = []; |
| // WRONG | |
| var mixedEmails = ['JOHN@ACME.COM', 'Mary@FooBar.com', 'monty@spam.eggs']; | |
| var tempList = []; | |
| for (var i = 0; i < mixedEmails.length; i++) { | |
| tempList.push(mixedEmails[i].toLowerCase()); | |
| } | |
| document.getElementsByTagName('body')[0].innerHTML += 'Old method: ' + tempList; |