I hereby claim:
- I am nyagarcia on github.
- I am nyachan (https://keybase.io/nyachan) on keybase.
- I have a public key ASCX_KYHXdj9trZ43Hq4aShjNWxZxVQ-XNDJM8IMc9sV1go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
const mySquirtle = { | |
name: 'Squirtle', | |
type: 'Water', | |
hp: 100 | |
}; | |
const anotherSquirtle = mySquirtle; | |
anotherSquirtle.hp = 0; | |
console.log(mySquirtle); //Result: { name: 'Squirtle', type: 'Water', hp: 0 } |
const mySquirtle = { | |
name: 'Squirtle', | |
type: 'Water', | |
hp: 100 | |
}; | |
const anotherSquirtle = { ...mySquirtle }; | |
anotherSquirtle.hp = 0; | |
console.log(anotherSquirtle); //Result: { name: 'Squirtle', type: 'Water', hp: 0 } |
const pokemon = ['Squirtle', 'Bulbasur', 'Charmander']; | |
const pokedex = [...pokemon]; | |
pokedex.push('Cyndaquil'); | |
console.log(pokemon); //[ 'Squirtle', 'Bulbasur', 'Charmander' ] | |
console.log(pokedex); //[ 'Squirtle', 'Bulbasur', 'Charmander', 'Cyndaquil' ] |
const baseSquirtle = { | |
name: 'Squirtle', | |
type: 'Water' | |
}; | |
const squirtleDetails = { | |
species: 'Tiny Turtle Pokemon', | |
evolution: 'Wartortle' | |
}; |
const nodeList = document.getElementsByClassName("pokemon"); | |
const array = [...nodeList]; | |
console.log(nodeList); //Result: HTMLCollection [ div.pokemon, div.pokemon ] | |
console.log(array); //Result: Array [ div.pokemon, div.pokemon ] |
const pokemon = { | |
name: 'Squirtle', | |
type: 'Water', | |
abilities: ['Torrent', 'Rain Dish'] | |
}; | |
const squirtleClone = { ...pokemon }; | |
pokemon.name = 'Charmander'; | |
pokemon.abilities.push('Surf'); |
const numbers = [1, 4, 5]; | |
const max = Math.max(numbers[0], numbers[1], numbers[2]); | |
console.log(max); //Result: 5 |
const numbers = [1, 4, 5, 6, 9, 2, 3, 4, 5, 6]; | |
const max = Math.max(...numbers); | |
console.log(max); //Result: 9 |
const squirtle = { type: 'Water', ability: 'Torrent' }; | |
//Normal property destructuring: | |
const { type, ability } = squirtle; | |
console.log({ type }, { ability }); //Result: { type: 'water' } { ability: 'torrent' } | |
//Renaming properties | |
const { type: squirtleType, ability: superAwesomeAbility } = squirtle; | |
console.log({ squirtleType }, { superAwesomeAbility }); //Result: { squirtleType: 'Water' } { superAwesomeAbility : 'Torrent' } |