//Includes
let a = "heloo";
console.log(a.includes("oo"));
let b = [1, 2, 3];
console.log(b.includes(2));
//Power of
const square = (x) => x ** 2;
console.log(square(3));
const cube = (x) => x ** 3;
console.log(cube(3));
//ES8
//.padStart()
//.padEnd()
'Turtle'.padStart(10);
//" Turtle"
//Object.values - old
//Object.entries - new
//Object.keys - new
let obj = {
username0: 'Santa',
username1: 'Rudolf',
username2: 'Mr.Grinch'
}
Object.keys(obj).forEach((key, index) => {
console.log(key, obj[key]);
})
Object.values(obj).forEach(value => {
console.log(value);
})
Object.entries(obj).forEach(entry => {
console.log(entry);
})
Object.entries(obj).map(value => {
console.log(value[1] + value[0].replace('username', '_'));
})
// #3) Get the below object to go from:
let obj2 = {
my: 'name',
is: 'Rudolf',
the: 'raindeer'
}
// to this:
'my name is Rudolf the raindeer'
Object.entries(obj2).map(value => value.join(" ")).join(' ')