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() { console.log(Array.from(document.scripts).forEach(script => console.log(script))) })() |
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
console.time('users'); | |
axios.get('https://randomuser.me/api/?page=1&results=20') | |
.then(response => { | |
console.timeEnd('users'); | |
}); |
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
axios.get('https://randomuser.me/api/?page=1&results=5') | |
.then(response => { | |
const users = response.data; | |
users.results.forEach(user => { | |
const name = user.name; | |
const location = user.location; | |
const email = user.email; | |
console.groupCollapsed('User Details'); | |
console.log(name); |
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 addNumbers(numbers) { | |
let sum = 0; | |
numbers.forEach(function(value) { | |
sum += value; | |
}); | |
return sum; | |
} |
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 addNumbers(...numbers) { | |
let sum = 0; | |
numbers.forEach(function(value) { | |
sum += value; | |
}); | |
return sum; | |
} |
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 numbers = [1000, -20, 0, 40, 800]; | |
const max = Math.max(...numbers); | |
console.log(max); |
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 first = ["monday","tuesday"]; | |
const second = ["wednesday", "thursday", "friday"]; | |
const combined = [...first, ...second]; | |
console.log(combined); |
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 first = ["monday","tuesday"]; | |
const second = ["wednesday", "thursday", "friday"]; | |
const combined = first.concat(second); | |
console.log(combined); |
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 first = ["monday","tuesday"]; | |
const second = ["wednesday", "thursday", "friday"]; | |
const combined = ["sunday", ...first, ...second, "saturday"]; | |
console.log(combined); |
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 numbers = [10, 20, 30, 40, 50]; | |
const [first, ...rest] = numbers; | |
console.log(first); | |
console.log(rest); |
OlderNewer