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 foo = { | |
t: { | |
s: function () { | |
console.log("bar"); | |
} | |
} | |
}, | |
bar = foo && foo.t && foo.t.s; | |
if (bar) { |
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
KT.namespace("algo"); | |
KT.algo.romanNumberals = (function () { | |
"use strict"; | |
function getKeyValueObject(number, romanNumber) { | |
return { | |
"part": number, | |
"romanNumber": romanNumber | |
}; |
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
function reverse(string) { | |
return (typeof string !== "string") ? "" : string.split('').reverse().join(''); | |
} |
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
KT.namespace("algo"); | |
KT.algo.fizzBuzz = { | |
getValue: function (input) { | |
return ((input % 3 && !(input + '').match(/3/i)) ? (input % 5 && !(input + '').match(/5/i)) ? input : "" : "fizz") + | |
((input % 5 && !(input + '').match(/5/i)) ? "" : "Buzz"); | |
} | |
}; |
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
KT.namespace("fun"); | |
KT.fun.tree = (function () { | |
"use strict"; | |
return function (height) { | |
var row = 1; | |
return (isNaN(height) || height <= 0) ? '' : new Array(height).join('.').split('.').map(function () { | |
return new Array(height - row + 1).join(" ") + new Array(row++ * 2).join("*"); | |
}).join('\n'); |
NewerOlder