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

const set = new Set([1, 1, 2, 3, 4]);

console.log(set);
57. What's the output?

// counter.js
let counter = 10;
export default counter;

// index.js
import myCounter from './counter';

myCounter += 1;

console.log(myCounter);
57. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: 10
0%
B: 11
100%
C: Error
0%
D: NaN
58. What's the output?

const name = 'Lydia';
age = 21;

console.log(delete name);
console.log(delete age);
58. What's the output?

Javob variantlari:
Anonymous Quiz
100%
A: false, true
0%
B: "Lydia", 21
0%
C: true, true
0%
D: undefined, undefined
59. What's the output?

const numbers = [1, 2, 3, 4, 5];
const [y] = numbers;

console.log(y);
59. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: [[1, 2, 3, 4, 5]]
0%
B: [1, 2, 3, 4, 5]
100%
C: 1
0%
D: [1]
60. What's the output?

const user = { name: 'Lydia', age: 21 };
const admin = { admin: true, ...user };

console.log(admin);
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;
}

};