This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Without Array Destructuring | |
var nameArr = "Colin Toh".split(" "); | |
var firstName = nameArr[0], | |
lastName = nameArr[1]; | |
console.log(firstName); // Colin | |
// With Array Destructuring | |
var [firstName,lastName] = nameArr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = new Array(3); | |
for (var i = 0; i<arr.length; i++) { | |
console.log(i); // 0,1,2,3 | |
} | |
console.log(i); // 3 | |
for(let j = 0; j < arr.length; j++){} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var name = "Colin"; | |
let nameBlock = "John"; | |
if(true){ | |
var name = "Max"; | |
let nameBlock = "Min"; | |
console.log(name); //Max | |
console.log(nameBlock); //Min | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _consoleLog = console.log; | |
console.log = function(){ | |
var name = _consoleLog.apply(console,arguments); | |
var str = ""; | |
for(var index in arguments){ | |
if(Array.isArray(arguments[index])){ | |
arguments[index] = arguments[index].map(function(item){ | |
if(typeof item == "object"){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = "overzealous optimization programming".split(""), | |
i = 0; | |
while (i < arr.length) { | |
console.log(arr[i]); | |
i++; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = "overzealous optimization programming".split(""); | |
for(var i = 0, l = arr.length; i < l; i++) { | |
console.log(arr[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = "overzealous optimization programming".split(""); | |
for(var i = 0; i < arr.length; i++) { | |
console.log(arr[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Predefined Settings | |
*/ | |
var model = { | |
daysObj: { | |
0: [0,1,2,3,4,5,6], | |
1: [1,2,3,4,5,6,0], | |
2: [2,3,4,5,6,0,1], | |
3: [3,4,5,6,0,1,2], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Call bindEvents in the init() | |
function bindEvents(){ | |
var $container = $('.container'); | |
$container.on('click','#button--solve',buttonSolveCallback); | |
$container.on('click','.instruction_close',function(){ $("#blackout-4").fadeOut(); }); |
NewerOlder