Daily JavaScript
15 subscribers
1 photo
1 link
Daily examples, coding challenges, and useful tips for developers.
Download Telegram
10. What happens when we do this?

function bark() {
console.log('Woof!');
}

bark.animal = 'dog';
11. What's the output?

function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}

const member = new Person('Lydia', 'Hallie');
Person.getFullName = function() {
return `${this.firstName} ${this.lastName}`;
};

console.log(member.getFullName());
11. What's the output?

Javob variantlari:
Anonymous Quiz
100%
A: TypeError
0%
B: SyntaxError
0%
C: Lydia Hallie
0%
D: undefined undefined
12. What's the output?

function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}

const lydia = new Person('Lydia', 'Hallie');
const sarah = Person('Sarah', 'Smith');

console.log(lydia);
console.log(sarah);
14. All object have prototypes.
Anonymous Quiz
0%
A: true
100%
B: false
15. What's the output?

function sum(a, b) {
return a + b;
}

sum(1, '2');
15. What's the output?

Javob variantlar:
Anonymous Quiz
0%
A: NaN
0%
B: TypeError
100%
C: "12"
0%
D: 3
16. What's the output?

let number = 0;
console.log(number++);
console.log(++number);
console.log(number);
16. What's the output?

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

function getPersonInfo(one, two, three) {
console.log(one);
console.log(two);
console.log(three);
}

const person = 'Lydia';
const age = 21;

getPersonInfo`${person} is ${age} years old`;
18. What's the output?

function checkAge(data) {
if (data === { age: 18 }) {
console.log('You are an adult!');
} else if (data == { age: 18 }) {
console.log('You are still an adult.');
} else {
console.log(`Hmm.. You don't have an age I guess`);
}
}

checkAge({ age: 18 });
19. What's the output?

function getAge(...args) {
console.log(typeof args);
}

getAge(21);
19. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: "number"
0%
B: "array"
100%
C: "object"
0%
D: "NaN"
20. What's the output?

function getAge() {
'use strict';
age = 21;
console.log(age);
}

getAge();
20. What's the output?

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

const sum = eval('10*10+5');
Anonymous Quiz
100%
A: 105
0%
B: "105"
0%
C: TypeError
0%
D: "10*10+5"