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

String.prototype.giveLydiaPizza = () => {
return 'Just give Lydia pizza already!';
};

const name = 'Lydia';

console.log(name.giveLydiaPizza())
29. What's the output?

const a = {};
const b = { key: 'b' };
const c = { key: 'c' };

a[b] = 123;
a[c] = 456;

console.log(a[b]);
29. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: 123
100%
B: 456
0%
C: undefined
0%
D: ReferenceError
30. What's the output?

const foo = () => console.log('First');
const bar = () => setTimeout(() => console.log('Second'));
const baz = () => console.log('Third');

bar();
foo();
baz();
31. What is the event.target when clicking the button?

<div onclick="console.log('first div')">
<div onclick="console.log('second div')">
<button onclick="console.log('button')">
Click!
</button>
</div>
</div>
31. What is the event.target when clicking the button?

Javob variantlari:
Anonymous Quiz
0%
A: Outer div
0%
B: Inner div
100%
C: button
0%
D: An array of all nested elements.
32. When you click the paragraph, what's the logged output?

<div onclick="console.log('div')">
<p onclick="console.log('p')">
Click here!
</p>
</div>
32. When you click the paragraph, what's the logged output?

Javob variantlari:
Anonymous Quiz
100%
A: p div
0%
B: div p
0%
C: p
0%
D: div
33. What's the output?

const person = { name: 'Lydia' };

function sayHi(age) {
return `${this.name} is ${age}`;
}

console.log(sayHi.call(person, 21));
console.log(sayHi.bind(person, 21));
34. What's the output?

function sayHi() {
return (() => 0)();
}

console.log(typeof sayHi());
34. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: "object"
100%
B: "number"
0%
C: "function"
0%
D: "undefined"
35. Which of these values are falsy?

0;
new Number(0);
('');
(' ');
new Boolean(false);
undefined;
36. What's the output?

console.log(typeof typeof 1); Javob variantlari:
Anonymous Quiz
0%
A: "number"
100%
B: "string"
0%
C: "object"
0%
D: "undefined"
37. What's the output?

const numbers = [1, 2, 3];
numbers[10] = 11;
console.log(numbers);
38. What's the output?

(() => {
let x, y;
try {
throw new Error();
} catch (x) {
(x = 1), (y = 2);
console.log(x);
}
console.log(x);
console.log(y);
})();