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
async function getStarWarsHeroes() { | |
let retryLimit = 3; | |
let success = false; | |
// API is not always returning data (500 erros happens) so we extend your tries to 3 times that explain a for loop | |
for (let it = 0; it < retryLimit; ++it) { | |
let data = await axios.get('...') | |
.then(response => response.json()) | |
.then(json => { | |
success = true; | |
return json; |
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
let config = {}; | |
config.controller = {}; | |
config.controller.play = function() { | |
console.log(this.prop); | |
} | |
config.controller.prop = "manny"; | |
let appPlay = config.controller.play.bind(config.controller); | |
console.log(appPlay()); |
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 app = { | |
db: {}, | |
next_id: 0, | |
create: function(newThing) { | |
// this.db[this.next_id] = newThing; | |
// this.next_id ++; | |
if(newThing !== ''){ | |
this.db[this.next_id] = newThing; | |
this.next_id ++; | |
console.log("THING WAS ADDED") |
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
let bottle_state = 0; | |
let extra_water= 0; | |
function read_water_level(bottle_state){ | |
console.log(bottle_state) | |
}; | |
function drink_water(bottle_fullness, thirst_score, bottle_size) { | |
let new_bottle_state = 0; |
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 app = { | |
db: {}, | |
next_id: 0, | |
create: function(newThing) { | |
// this.db[this.next_id] = newThing; | |
// this.next_id ++; | |
if(newThing !== ''){ | |
this.db[this.next_id] = newThing; | |
this.next_id ++; | |
console.log("THING WAS ADDED") |
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
// an example to learn about dots and brackets | |
// below are 6 test cases that work | |
// try writing some that break, find out what's happening | |
var og = {first: 'fifty', last: 'cent'}; | |
var curtis = 'first'; | |
var jackson = 'last'; | |
console.log(og.first); |
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
https://www.codewars.com/kata/coding-meetup-number-2-higher-order-functions-series-greet-developers | |
*/ | |
You will be given an array of objects (associative arrays in PHP) representing data about developers who have signed up to attend the next coding meetup that you are organising. | |
Your task is to return an array where each object will have a new property 'greeting' with the following string value: | |
Hi < firstName here >, what do you like the most about < language here >? |
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 challenge1 (a, b, c){ | |
let base1 = Number.parseInt(a, b); | |
let base2 = Number.parseInt(base1, c); | |
return base2.toString(); | |
} | |
console.log(challenge1 (10, 2, 10)) | |