This file contains hidden or 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
// try this online: https://codepen.io/Xiwi/pen/jOEXJRa?editors=0010 | |
// (don't forget to open the console) | |
const getData = function(url) { | |
axios.get(url) | |
.then(function(response){ | |
let follow = response.data.follow; | |
if (follow) { | |
follow = follow.replace('challenge?', 'challenge.json?'); | |
console.log(follow); |
This file contains hidden or 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
// First try I was detecting if it was an array or not and create some loops | |
// if so, but I thought on an easier way to avoid some recursivity | |
const fixArray = function(array) { | |
const arrayString = array.toLocaleString(); // "1,2,3..." | |
const fixedArray = arrayString.split(',').map(function(item) { | |
return parseInt(item, 10); | |
}); | |
console.log(fixedArray); |