Daily JavaScript
15 subscribers
1 photo
1 link
Daily examples, coding challenges, and useful tips for developers.
Download Telegram
70. What's the output?

console.log('🥑' + '💻');
Anonymous Quiz
50%
A: "🥑💻"
0%
B: 257548
50%
C: A string containing their code points
0%
D: Error
71. How can we log the values that are commented out after the console.log statement?

function* startGame() {
const answer = yield 'Do you love JavaScript?';
if (answer !== 'Yes') {
return "Oh wow... Guess we're done here";
}
return 'JavaScript loves you back ❤️';
}

const game = startGame();
console.log(/* 1 */); // Do you love JavaScript?
console.log(/* 2 */); // JavaScript loves you back ❤️
71. How can we log the values that are commented out after the console.log statement?

Javob variantlari:
Anonymous Quiz
50%
A: game.next("Yes").value and game.next().value
0%
B: game.next.value("Yes") and game.next.value()
50%
C: game.next().value and game.next("Yes").value
0%
D: game.next.value() and game.next.value("Yes")
72. What's the output?

console.log(String.raw`Hello\nworld`); ⬇️ - bu belgi pastki qatorda degani
Anonymous Quiz
0%
A: Hello world!
0%
B: Hello⬇️ world
100%
C: Hello\nworld
0%
D: Hello\n⬇️ world
73. What's the output?

async function getData() {
return await Promise.resolve('I made it!');
}

const data = getData();
console.log(data);
74. What's the output?

function addToList(item, list) {
return list.push(item);
}

const result = addToList('apple', ['banana']);
console.log(result);
74. What's the output?

Javob variantlari;
Anonymous Quiz
0%
A: ['apple', 'banana']
50%
B: 2
0%
C: true
50%
D: undefined
75. What's the output?

const box = { x: 10, y: 20 };

Object.freeze(box);

const shape = box;
shape.x = 100;

console.log(shape);
76. What's the output?

const { firstName: myName } = { firstName: 'Lydia' };

console.log(firstName);
76. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: "Lydia"
0%
B: "myName"
0%
C: undefined
100%
D: ReferenceError
77. Is this a pure function?

function sum(a, b) {
return a + b;
}
77. Is this a pure function?

Javob variantlari:
Anonymous Quiz
100%
A: Yes
0%
B: No
78. What is the output?

const add = () => {
const cache = {};
return num => {
if (num in cache) {
return `From cache! ${cache[num]}`;
} else {
const result = num + 10;
cache[num] = result;
return `Calculated! ${result}`;
}
};
};

const addFunction = add();
console.log(addFunction(10));
console.log(addFunction(10));
console.log(addFunction(5 * 2));
79. What is the output?

const myLifeSummedUp = ['☕️', '💻', '🍷', '🍫'];

for (let item in myLifeSummedUp) {
console.log(item);
}

for (let item of myLifeSummedUp) {
console.log(item);
}
80. What is the output?

const list = [1 + 2, 1 * 2, 1 / 2];
console.log(list);