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

function getItems(fruitList, ...args, favoriteFruit) {
return [...fruitList, ...args, favoriteFruit]
}

getItems(["banana", "apple"], "pear", "orange")
95. What's the output?

function nums(a, b) {
if (a > b) console.log('a is bigger');
else console.log('b is bigger');
return
a + b;
}

console.log(nums(4, 2));
console.log(nums(1, 2));
96. What's the output?

class Person {
constructor() {
this.name = 'Lydia';
}
}

Person = class AnotherPerson {
constructor() {
this.name = 'Sarah';
}
};

const member = new Person();
console.log(member.name);
96. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: "Lydia"
0%
B: "Sarah"
0%
C: Error: cannot redeclare Person
0%
D: SyntaxError
97. What's the output?

const info = {
[Symbol('a')]: 'b',
};

console.log(info);
console.log(Object.keys(info));
98. What's the output?

const getList = ([x, ...y]) => [x, y]
const getUser = user => { name: user.name, age: user.age }

const list = [1, 2, 3, 4]
const user = { name: "Lydia", age: 21 }

console.log(getList(list))
console.log(getUser(user))
99. What's the output?

const name = 'Lydia';

console.log(name());
99. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: SyntaxError
0%
B: ReferenceError
0%
C: TypeError
0%
D: undefined
100. What's the value of output?

// 🎉 This is my 100th question! 🎉

const output = `${[] && 'Im'}possible!
You should${'' && `n't`} see a therapist after so much JavaScript lol`;
111. What's the output?

let name = 'Lydia';

function getName() {
console.log(name);
let name = 'Sarah';
}

getName();
111. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: Lydia
0%
B: Sarah
0%
C: undefined
0%
D: ReferenceError
112. What's the output?

function* generatorOne() {
yield ['a', 'b', 'c'];
}

function* generatorTwo() {
yield* ['a', 'b', 'c'];
}

const one = generatorOne();
const two = generatorTwo();

console.log(one.next().value);
console.log(two.next().value);
113. What's the output?

console.log(`${(x => x)('I love')} to program`);
Anonymous Quiz
0%
A: I love to program
0%
B: undefined to program
0%
C: ${(x => x)('I love') to program
0%
D: TypeError
114. What will happen?

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

config = null;