Skip to content

Commit 091ef31

Browse files
committed
syncs to August 17 and translates 95-96
1 parent 16628eb commit 091ef31

File tree

1 file changed

+241
-1
lines changed

1 file changed

+241
-1
lines changed

tr-TR/README-tr_TR.md

Lines changed: 241 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[Instagram](https://www.instagram.com/theavocoder) hesabımda, günlük olarak çoktan seçmeli Javascript soruları paylaşıyorum, ayrıca burada da paylaşacağım!
44

5-
Temelden ileri düzeye: Javascript'i ne kadar iyi bildiğinizi test edin, bilginizi biraz tazeleyin ya da mülakatanıza hazırlanın! :muscle: :rocket: Repoyu haftalık olarak yeni sorularla güncelliyorum. Son güncelleme: <a href=#20190805><b>5 Ağustos</b></a>
5+
Temelden ileri düzeye: Javascript'i ne kadar iyi bildiğinizi test edin, bilginizi biraz tazeleyin ya da mülakatanıza hazırlanın! :muscle: :rocket: Repoyu haftalık olarak yeni sorularla güncelliyorum. Son güncelleme: <a href=#20190817><b>17 Ağustos</b></a>
66

77
Cevaplar, soruların altında gizlenmiştir. Görmek için sadece tıklayın. İyi şanşlar :heart:
88

@@ -2972,3 +2972,243 @@ Yukarıdaki örnek çalışır. `[ 'banana', 'apple', 'orange', 'pear' ]` dizisi
29722972

29732973
</p>
29742974
</details>
2975+
2976+
---
2977+
2978+
###### <a name=20190817></a>95. Çıktısı Nedir?
2979+
2980+
```javascript
2981+
function nums(a, b) {
2982+
if
2983+
(a > b)
2984+
console.log('a is bigger')
2985+
else
2986+
console.log('b is bigger')
2987+
return
2988+
a + b
2989+
}
2990+
2991+
console.log(nums(4, 2))
2992+
console.log(nums(1, 2))
2993+
```
2994+
2995+
- A: `a is bigger`, `6` ve `b is bigger`, `3`
2996+
- B: `a is bigger`, `undefined` ve `b is bigger`, `undefined`
2997+
- C: `undefined` ve `undefined`
2998+
- D: `SyntaxError`
2999+
3000+
<details><summary><b>Cevap</b></summary>
3001+
<p>
3002+
3003+
#### Cevap: B
3004+
3005+
JavaScript'te, noktalı virgülü (`;`) özellikle yazmak _zorunda değiliz_, ancak JavaScript motoru ifadelerden sonra noktalı virgül eklemektedir. bu **Automatic Semicolon Insertion**, **Otomatik Noktalı Virgül Ekleme**, olarak adlandırılır. İfade, örneğin, değişkenler ya da `throw`, `return`, `break`, vb. gibi anahtar kelimeler olabilir.
3006+
3007+
Burada, bir `return` ifadesi yazdık, ve _yeni bir satırda_ başka bir değer olarak `a + b`. Ancak, `a + b` yeni satırda olduğundan, JavaScript motoru onun aslında bizim döndürmek istediğimiz değer olduğunu bilmiyor. Onun yerine, `return`'den sonra otomatik olarak noktalı virgül ekliyor. Şöyle düşünebilirsiniz:
3008+
3009+
```javascript
3010+
return;
3011+
a + b
3012+
```
3013+
3014+
Fonksiyon `return` anahtar kelimesinden sonra çalışmayı durduracağından, `a + b` asla ulaşılamaz demektir. Eğer hiçbir değer döndürülmezse, fonksiyon `undefined` döndürür. Dikkat etmeniz gereken, `if/else` ifadelerinden sonra otomatik ekleme yapılmadığıdır!
3015+
3016+
</p>
3017+
</details>
3018+
3019+
---
3020+
3021+
###### 96. Çıktısı Nedir?
3022+
3023+
```javascript
3024+
class Person {
3025+
constructor() {
3026+
this.name = "Lydia"
3027+
}
3028+
}
3029+
3030+
Person = class AnotherPerson {
3031+
constructor() {
3032+
this.name = "Sarah"
3033+
}
3034+
}
3035+
3036+
const member = new Person()
3037+
console.log(member.name)
3038+
```
3039+
3040+
- A: `"Lydia"`
3041+
- B: `"Sarah"`
3042+
- C: `Error: cannot redeclare Person`
3043+
- D: `SyntaxError`
3044+
3045+
<details><summary><b>Cevap</b></summary>
3046+
<p>
3047+
3048+
#### Cevap: B
3049+
3050+
Sınıfları diğer sınıf/fonksiyon yapıcılara eşitleyebiliriz. Bu örnekte, `Person``AnotherPerson`'a eşitliyoruz. Bu yapıcıdaki `name` `Sarah`'dır, yani `Person` instance'ı olan `member` üzerindeki `name` özelliği `"Sarah"`'tır.
3051+
3052+
</p>
3053+
</details>
3054+
3055+
---
3056+
3057+
###### 97. Çıktısı Nedir?
3058+
3059+
```javascript
3060+
const info = {
3061+
[Symbol('a')]: 'b'
3062+
}
3063+
3064+
console.log(info)
3065+
console.log(Object.keys(info))
3066+
```
3067+
3068+
- A: `{Symbol('a'): 'b'}` and `["{Symbol('a')"]`
3069+
- B: `{}` and `[]`
3070+
- C: `{ a: "b" }` and `["a"]`
3071+
- D: `{Symbol('a'): 'b'}` and `[]`
3072+
3073+
<details><summary><b>Cevap</b></summary>
3074+
<p>
3075+
3076+
#### Cevap: D
3077+
3078+
A Symbol is not _enumerable_. The Object.keys method returns all _enumerable_ key properties on an object. The Symbol won't be visible, and an empty array is returned. When logging the entire object, all properties will be visible, even non-enumerable ones.
3079+
3080+
This is one of the many qualities of a symbol: besides representing an entirely unique value (which prevents accidental name collision on objects, for example when working with 2 libraries that want to add properties to the same object), you can also "hide" properties on objects this way (although not entirely. You can still access symbols using the `Object.getOwnPropertySymbols()` method).
3081+
3082+
</p>
3083+
</details>
3084+
3085+
---
3086+
3087+
###### 98. Çıktısı Nedir?
3088+
3089+
```javascript
3090+
const getList = ([x, ...y]) => [x, y]
3091+
const getUser = user => { name: user.name, age: user.age }
3092+
3093+
const list = [1, 2, 3, 4]
3094+
const user = { name: "Lydia", age: 21 }
3095+
3096+
console.log(getList(list))
3097+
console.log(getUser(user))
3098+
```
3099+
3100+
- A: `[1, [2, 3, 4]]` and `undefined`
3101+
- B: `[1, [2, 3, 4]]` and `{ name: "Lydia", age: 21 }`
3102+
- C: `[1, 2, 3, 4]` and `{ name: "Lydia", age: 21 }`
3103+
- D: `Error` and `{ name: "Lydia", age: 21 }`
3104+
3105+
<details><summary><b>Cevap</b></summary>
3106+
<p>
3107+
3108+
#### Cevap: A
3109+
3110+
The `getList` function receives an array as its argument. Between the parentheses of the `getList` function, we destructure this array right away. You could see this as:
3111+
3112+
`[x, ...y] = [1, 2, 3, 4]`
3113+
3114+
With the rest parameter `...y`, we put all "remaining" arguments in an array. The remaining arguments are `2`, `3` and `4` in this case. The value of `y` is an array, containig all the rest parameters. The value of `x` is equal to `1` in this case, so when we log `[x, y]`, `[1, [2, 3, 4]]` gets logged.
3115+
3116+
The `getUser` function receives an object. With arrow functions, we don't _have_ to write curly brackets if we just return one value. However, if you want to return an _object_ from an arrow function, you have to write it between parentheses, otherwise no value gets returned! The following function would have returned an object:
3117+
3118+
```const getUser = user => ({ name: user.name, age: user.age })```
3119+
3120+
Since no value gets returned in this case, the function returns `undefined`.
3121+
3122+
</p>
3123+
</details>
3124+
3125+
---
3126+
3127+
###### 99. Çıktısı Nedir?
3128+
3129+
```javascript
3130+
const name = "Lydia"
3131+
3132+
console.log(name())
3133+
```
3134+
3135+
- A: `SyntaxError`
3136+
- B: `ReferenceError`
3137+
- C: `TypeError`
3138+
- D: `undefined`
3139+
3140+
<details><summary><b>Cevap</b></summary>
3141+
<p>
3142+
3143+
#### Cevap: C
3144+
3145+
The variable `name` holds the value of a string, which is not a function, thus cannot invoke.
3146+
3147+
TypeErrors get thrown wehn a value is not of the expected type. JavaScript expected `name` to be a function since we're trying to invoke it. It was a string however, so a TypeError gets thrown: name is not a function!
3148+
3149+
SyntaxErrors get thrown when you've written something that isn't valid JavaScript, for example when you've written the word `return` as `retrun`.
3150+
ReferenceErrors get thrown when JavaScript isn't able to find a reference to a value that you're trying to access.
3151+
3152+
</p>
3153+
</details>
3154+
3155+
---
3156+
3157+
###### 100. What's the value of output?
3158+
3159+
```javascript
3160+
// 🎉✨ This is my 100th question! ✨🎉
3161+
3162+
const output = `${[] && 'Im'}possible!
3163+
You should${'' && `n't`} see a therapist after so much JavaScript lol`
3164+
```
3165+
3166+
- A: `possible! You should see a therapist after so much JavaScript lol`
3167+
- B: `Impossible! You should see a therapist after so much JavaScript lol`
3168+
- C: `possible! You shouldn't see a therapist after so much JavaScript lol`
3169+
- D: `Impossible! You shouldn't see a therapist after so much JavaScript lol`
3170+
3171+
<details><summary><b>Cevap</b></summary>
3172+
<p>
3173+
3174+
#### Cevap: B
3175+
3176+
`[]` is a truthy value. With the `&&` operator, the right-hand value will be returned if the left-hand value is a truthy value. In this case, the left-hand value `[]` is a truthy value, so `"Im'` gets returned.
3177+
3178+
`""` is a falsy value. If the left-hand value is falsy, nothing gets returned. `n't` doesn't get returned.
3179+
3180+
</p>
3181+
</details>
3182+
3183+
---
3184+
3185+
###### 101. What's the value of output?
3186+
3187+
```javascript
3188+
const one = (false || {} || null)
3189+
const two = (null || false || "")
3190+
const three = ([] || 0 || true)
3191+
3192+
console.log(one, two, three)
3193+
```
3194+
3195+
- A: `false` `null` `[]`
3196+
- B: `null` `""` `true`
3197+
- C: `{}` `""` `[]`
3198+
- D: `null` `null` `true`
3199+
3200+
<details><summary><b>Cevap</b></summary>
3201+
<p>
3202+
3203+
#### Cevap: C
3204+
3205+
With the `||` operator, we can return the first truthy operand. If all values are falsy, the last operand gets returned.
3206+
3207+
`(false || {} || null)`: the empty object `{}` is a truthy value. This is the first (and only) truthy value, which gets returned. `one` is equal to `{}`.
3208+
3209+
`(null || false || "")`: all operands are falsy values. This means that the past operand, `""` gets returned. `two` is equal to `""`.
3210+
3211+
`([] || 0 || "")`: the empty array`[]` is a truthy value. This is the first truthy value, which gets returned. `three` is equal to `[]`.
3212+
3213+
</p>
3214+
</details>

0 commit comments

Comments
 (0)