Daily JavaScript
15 subscribers
1 photo
1 link
Daily examples, coding challenges, and useful tips for developers.
Download Telegram
114. What will happen?

let config = {
alert: setInterval(() => {
console.log('Alert!');
}, 1000),
};

config = null;
115. Which method(s) will return the value 'Hello world!'?

const myMap = new Map();
const myFunc = () => 'greeting';

myMap.set(myFunc, 'Hello world!');

//1
myMap.get('greeting');
//2
myMap.get(myFunc);
//3
myMap.get(() => 'greeting');
115. Which method(s) will return the value 'Hello world!'?

Javob variantlari:
Anonymous Quiz
0%
A: 1
0%
B: 2
0%
C: 2 and 3
0%
D: All of them
116. What's the output?

const person = {
name: 'Lydia',
age: 21,
};

const changeAge = (x = { ...person }) => (x.age += 1);
const changeAgeAndName = (x = { ...person }) => {
x.age += 1;
x.name = 'Sarah';
};

changeAge(person);
changeAgeAndName();

console.log(person);
117. Which of the following options will return 6?

function sumValues(x, y, z) {
return x + y + z;
}
117. Which of the following options will return 6?

Javob variantlari:
Anonymous Quiz
0%
A: sumValues([...1, 2, 3])
0%
B: sumValues([...[1, 2, 3]])
0%
C: sumValues(...[1, 2, 3])
0%
D: sumValues([1, 2, 3])
118. What's the output?

let num = 1;
const list = ['🥳', '🤠', '🥰', '🤪'];

console.log(list[(num += 1)]);
118. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: 🤠
0%
B: 🥰
0%
C: SyntaxError
0%
D: ReferenceError
119. What's the output?

const person = {
firstName: 'Lydia',
lastName: 'Hallie',
pet: {
name: 'Mara',
breed: 'Dutch Tulip Hound',
},
getFullName() {
return `${this.firstName} ${this.lastName}`;
},
};

console.log(person.pet?.name);
console.log(person.pet?.family?.name);
console.log(person.getFullName?.());
console.log(member.getLastName?.());
120. What's the output?

const groceries = ['banana', 'apple', 'peanuts'];

if (groceries.indexOf('banana')) {
console.log('We have to buy bananas!');
} else {
console.log(`We don't have to buy bananas!`);
}
121. What's the output?

const config = {
languages: [],
set language(lang) {
return this.languages.push(lang);
},
};

console.log(config.language);
122. What's the output?

const name = 'Lydia Hallie';

console.log(!typeof name === 'object');
console.log(!typeof name === 'string');
122. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: false true
0%
B: true false
0%
C: false false
0%
D: true true
123. What's the output?


const add = x => y => z => {
console.log(x, y, z);
return x + y + z;
};

add(4)(5)(6);
123. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: 4 5 6
0%
B: 6 5 4
0%
C: 4 function function
0%
D: undefined undefined 6