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

const person = { name: 'Lydia' };

Object.defineProperty(person, 'age', { value: 21 });

console.log(person);
console.log(Object.keys(person));
62. What's the output?

const settings = {
username: 'lydiahallie',
level: 19,
health: 90,
};

const data = JSON.stringify(settings, ['level', 'health']);
console.log(data);
63. What's the output?

let num = 10;

const increaseNumber = () => num++;
const increasePassedNumber = number => number++;

const num1 = increaseNumber();
const num2 = increasePassedNumber(num1);

console.log(num1);
console.log(num2);
63. What's the output?

Javob variantlari:
Anonymous Quiz
100%
A: 10, 10
0%
B: 10, 11
0%
C: 11, 11
0%
D: 11, 12
64. What's the output?

const value = { number: 10 };

const multiply = (x = { ...value }) => {
console.log((x.number *= 2));
};

multiply();
multiply();
multiply(value);
multiply(value);
66. With which constructor can we successfully extend the Dog class?

class Dog {
constructor(name) {
this.name = name;
}
};

class Labrador extends Dog {
// 1
constructor(name, size) {
this.size = size;
}
// 2
constructor(name, size) {
super(name);
this.size = size;
}
// 3
constructor(size) {
super(name);
this.size = size;
}
// 4
constructor(name, size) {
this.name = name;
this.size = size;
}

};
66. With which constructor can we successfully extend the Dog class?

Javob variantlari:
Anonymous Quiz
0%
A: 1
100%
B: 2
0%
C: 3
0%
D: 4
67. What's the output?

// index.js
console.log('running index.js');
import { sum } from './sum.js';
console.log(sum(1, 2));

// sum.js
console.log('running sum.js');
export const sum = (a, b) => a + b;
68. What's the output?

console.log(Number(2) === Number(2));
console.log(Boolean(false) === Boolean(false));
console.log(Symbol('foo') === Symbol('foo'));
69. What's the output?

const name = 'Lydia Hallie';
console.log(name.padStart(13));
console.log(name.padStart(2));
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 ❤️