View KATA: Parse Int from Char Problem
function getAge(inputString){ | |
return parseInt(inputString.charAt(0)); | |
} |
View KATA: First Non-Consecutive Numbers
function firstNonConsecutive (arr) { | |
for(let i = 0; i < arr.length-1; i++) { | |
if(arr[i] + 1 !== arr[i + 1]) { | |
return arr[i + 1]; | |
} | |
} | |
return null | |
} |
View KATA: Duck, Duck, Goose
function duckDuckGoose(players, goose) { | |
return players[(goose-1) % players.length].name; | |
} |
View KATA: Remove Extra Exclamation Marks
function remove(s){ | |
//coding and coding.... | |
return s.split('!').join('') + '!'; | |
} |
View KATA: I love you, a little, a lot, passionately... not at all
function howMuchILoveYou(nbPetals) { | |
if(nbPetals % 6 === 1) { | |
return 'I love you'; | |
} else if (nbPetals % 6 === 2) { | |
return 'a little' | |
} else if (nbPetals % 6 === 3) { | |
return 'a lot'; | |
} else if (nbPetals % 6 === 4) { | |
return 'passionately'; | |
} else if (nbPetals % 6 === 5) { |
View KATA: Welcome!
function greet(language) { | |
var database = { | |
english: "Welcome", | |
czech: "Vitejte", | |
danish: "Velkomst", | |
dutch: "Welkom", | |
estonian: "Tere tulemast", | |
finnish: "Tervetuloa", | |
flemish: "Welgekomen", | |
french: "Bienvenue", |
View Verizon Samsung Galaxy S8 Interactive Video Embed Code
<iframeallowfullscreen="1" webkitAllowFullScreen id="interactiveExperience" width=720 height=405 class="embed-responsive-item" frameborder="0" src="https://ixd.invodo.com/verizon_embed/galaxy-test-index.html"></iframe> |
View KATA: Odd, Even, or Prime Number
function oddEven() { | |
for(let i = 1; i <= 100; i++) { | |
if(i % 2 === 0) { | |
console.log('Even'); | |
} else if (i % 2 !== 0 && i % 3 === 0 || i % 9 === 0 || i % 5 === 0){ | |
console.log('Odd'); | |
} else { | |
console.log(i); | |
} | |
} |
View KATA: FizzBuzz
function fizzbuzz() { | |
for(let i=0; i <= 100; i++) { | |
if(i % 15 === 0) { | |
console.log('FizzBuzz'); | |
} else if (i % 5 === 0) { | |
console.log('Fizz'); | |
} else if (i % 3 === 0) { | |
console.log('Buzz'); | |
} else { | |
console.log(i); |
View herbalife.js
$.getJSON("http://freegeoip.net/json/", function(data) { | |
// We need to evaluate the services for getting JSON - what should happen if this service goes down. We may need to code for that back-up. | |
var country = data.country_name; | |
var ip = data.ip; | |
// alert("country " + country); | |
// alert("IP " + ip); | |
var invodoVideoId = ""; |