Skip to content

Commit cb1e7f0

Browse files
authored
Merge branch 'master' into patch-1
2 parents 1c7755b + a6b5a5e commit cb1e7f0

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

README.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
I post daily multiple choice JavaScript questions on my [Instagram](https://www.instagram.com/theavocoder), which I'll also post here!
44

5-
From basic to advanced: test how well you know JavaScript, refresh your knowledge a bit, or prepare for your coding interview! :muscle: :rocket:
5+
From basic to advanced: test how well you know JavaScript, refresh your knowledge a bit, or prepare for your coding interview! :muscle: :rocket: I update this repo weekly with new questions.
66

77
The answers are in the collapsed sections below the questions, simply click on them to expand it. Good luck :heart:
88

@@ -242,6 +242,7 @@ However, when we use the `===` operator, both value _and_ type should be the sam
242242
class Chameleon {
243243
static colorChange(newColor) {
244244
this.newColor = newColor;
245+
return this.newColor;
245246
}
246247

247248
constructor({ newColor = "green" } = {}) {
@@ -400,7 +401,7 @@ We said that `this.firstName` equals `"Sarah"` and `this.lastName` equals `"Smit
400401

401402
---
402403

403-
###### 12. What are the three phases of event propagation?
404+
###### 13. What are the three phases of event propagation?
404405

405406
- A: Target > Capturing > Bubbling
406407
- B: Bubbling > Target > Capturing
@@ -421,7 +422,7 @@ During the **capturing** phase, the event goes through the ancestor elements dow
421422

422423
---
423424

424-
###### 13. All objects have prototypes.
425+
###### 14. All object have prototypes.
425426

426427
- A: true
427428
- B: false
@@ -438,7 +439,7 @@ All objects have prototypes, except for the **base object**. The base object has
438439

439440
---
440441

441-
###### 14. What's the output?
442+
###### 15. What's the output?
442443

443444
```javascript
444445
function sum(a, b) {
@@ -458,7 +459,7 @@ sum(1, "2");
458459

459460
#### Answer: C
460461

461-
JavaScript is a **dynamically typed language**: we don't specify what types certain variables are. Values can automatically be converted into another type without you knowing, which is called _implicit type coercion_. **Coercion** is converting from one type into another.
462+
JavaScript is a **dynamimcally typed language**: we don't specify what types certain variables are. Values can automatically be converted into another type without you knowing, which is called _implicit type coercion_. **Coercion** is converting from one type into another.
462463

463464
In this example, JavaScript converts the number `1` into a string, in order for the function to make sense and return a value. During the addition of a numeric type (`1`) and a string type (`'2'`), the number is treated as a string. We can concatenate strings like `"Hello" + "World"`, so what's happening here is `"1" + "2"` which returns `"12"`.
464465

@@ -467,7 +468,7 @@ In this example, JavaScript converts the number `1` into a string, in order for
467468

468469
---
469470

470-
###### 15. What's the output?
471+
###### 16. What's the output?
471472

472473
```javascript
473474
let number = 0;
@@ -503,7 +504,7 @@ This returns `0 2 2`.
503504

504505
---
505506

506-
###### 16. What's the output?
507+
###### 17. What's the output?
507508

508509
```javascript
509510
function getPersonInfo(one, two, three) {
@@ -518,9 +519,9 @@ const age = 21;
518519
getPersonInfo`${person} is ${age} years old`;
519520
```
520521

521-
- A: `Lydia` `21` `["", "is", "years old"]`
522-
- B: `["", "is", "years old"]` `Lydia` `21`
523-
- C: `Lydia` `["", "is", "years old"]` `21`
522+
- A: `"Lydia"` `21` `["", " is ", " years old"]`
523+
- B: `["", " is ", " years old"]` `"Lydia"` `21`
524+
- C: `"Lydia"` `["", " is ", " years old"]` `21`
524525

525526
<details><summary><b>Answer</b></summary>
526527
<p>
@@ -534,7 +535,7 @@ If you use tagged template literals, the value of the first argument is always a
534535

535536
---
536537

537-
###### 17. What's the output?
538+
###### 18. What's the output?
538539

539540
```javascript
540541
function checkAge(data) {
@@ -570,7 +571,7 @@ This is why both `{ age: 18 } === { age: 18 }` and `{ age: 18 } == { age: 18 }`
570571

571572
---
572573

573-
###### 18. What's the output?
574+
###### 19. What's the output?
574575

575576
```javascript
576577
function getAge(...args) {

0 commit comments

Comments
 (0)