You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -2469,7 +2469,7 @@ The third time, we pass `5 * 2` to the function which gets evaluated to `10`. Th
2469
2469
2470
2470
---
2471
2471
2472
-
###### <aname=20190726></a>79. What is the output?
2472
+
###### 79. What is the output?
2473
2473
2474
2474
```javascript
2475
2475
constmyLifeSummedUp= ["☕", "💻", "🍷", "🍫"]
@@ -2731,7 +2731,7 @@ By setting `hasName` equal to `name`, you set `hasName` equal to whatever value
2731
2731
2732
2732
---
2733
2733
2734
-
###### 87. What's the output?
2734
+
###### <aname=20190805></a>87. What's the output?
2735
2735
2736
2736
```javascript
2737
2737
console.log("I want pizza"[0])
@@ -2838,7 +2838,7 @@ console.log(typeof member)
2838
2838
<details><summary><b>Answer</b></summary>
2839
2839
<p>
2840
2840
2841
-
#### Answer: B
2841
+
#### Answer: C
2842
2842
2843
2843
Classes are syntactical sugar for function constructors. The equivalent of the `Person` class as a function constructor would be:
2844
2844
@@ -2848,7 +2848,7 @@ function Person() {
2848
2848
}
2849
2849
```
2850
2850
2851
-
Which results in the same value. A class is a function under the hood, the `typeof` keyword returns `"function"` for functions. `typeof Person` returns `"function"`.
2851
+
Calling a function constructor with `new` results in the creation of an instance of `Person`, `typeof` keyword returns `"object"` for an instance. `typeof member` returns `"object"`.
2852
2852
2853
2853
</p>
2854
2854
</details>
@@ -2889,9 +2889,7 @@ function giveLydiaPizza() {
2889
2889
return"Here is pizza!"
2890
2890
}
2891
2891
2892
-
functiongiveLydiaChocolate() {
2893
-
return"Here's chocolate... now go hit the gym already."
2894
-
}
2892
+
constgiveLydiaChocolate= () =>"Here's chocolate... now go hit the gym already."
2895
2893
2896
2894
console.log(giveLydiaPizza.prototype)
2897
2895
console.log(giveLydiaChocolate.prototype)
@@ -2916,38 +2914,6 @@ Regular functions, such as the `giveLydiaPizza` function, have a `prototype` pro
2916
2914
2917
2915
###### 93. What's the output?
2918
2916
2919
-
```javascript
2920
-
functiongiveLydiaPizza() {
2921
-
return"Here is pizza!"
2922
-
}
2923
-
2924
-
functiongiveLydiaChocolate() {
2925
-
return"Here's chocolate... now go hit the gym already."
2926
-
}
2927
-
2928
-
console.log(giveLydiaPizza.prototype)
2929
-
console.log(giveLydiaChocolate.prototype)
2930
-
```
2931
-
2932
-
- A: `{ constructor: ...}``{ constructor: ...}`
2933
-
- B: `{}``{ constructor: ...}`
2934
-
- C: `{ constructor: ...}``{}`
2935
-
- D: `{ constructor: ...}``undefined`
2936
-
2937
-
<details><summary><b>Answer</b></summary>
2938
-
<p>
2939
-
2940
-
#### Answer: D
2941
-
2942
-
Regular functions, such as the `giveLydiaPizza` function, have a `prototype` property, which is an object (prototype object) with a `constructor` property. Arrow functions however, such as the `giveLydiaChocolate` function, do not have this `prototype` property. `undefined` gets returned when trying to access the `prototype` property using `giveLydiaChocolate.prototype`.
2943
-
2944
-
</p>
2945
-
</details>
2946
-
2947
-
---
2948
-
2949
-
###### 94. What's the output?
2950
-
2951
2917
```javascript
2952
2918
constperson= {
2953
2919
name:"Lydia",
@@ -2983,7 +2949,7 @@ The second subarray is `[ "age", 21 ]`, with `x` equal to `"age"`, and `y` equal
0 commit comments