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
// 0.IS `addEventLister()` and `click` ... <EVENT> used? | |
// // => `this` === who triggered the <EVENT> | |
// 1.Is it an arrow function ? | |
// // => `this` in arrow function === `this` around(arrow function) the closest valid line | |
// 2.Is it `bind` `call` `apply` | |
// // => `this` === `this` inside those [key words method] | |
// 3.Is it called with prefix `.` | |
// // => `this` === who is in fornt of `.` | |
// // => no `.` added => `this` === window | |
const $ = console.log; |
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
const grabRickAndMorty = { | |
info: { | |
count: 591, | |
pages: 30, | |
next: 'https://rickandmortyapi.com/api/character/?page=2', | |
prev: null, | |
}, | |
results: [ | |
{ | |
id: 1, |
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
array.filter(function (item, position) { | |
return array.indexOf(item) == position | |
}) |
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
// Maybe the easiest way => play with dot | |
// issue!!! => the float after 5 are all token by 5? | |
/* | |
function grabRandomDotWay(min, max, toNthDecimals) { | |
let result = null; | |
const range = max - min; | |
result = Math.trunc((range + 1) * Math.random() * (toNthDecimals && (Math.pow(10, toNthDecimals)) || 1)); | |
// eg : result *= 0.01 | |
result = result * Math.pow(0.1, toNthDecimals || 0) + ''; | |
if (toNthDecimals) { |
NewerOlder