Skip to content

Commit 5540b52

Browse files
committed
Syncs to August 5th
1 parent 28a3f11 commit 5540b52

File tree

1 file changed

+255
-1
lines changed

1 file changed

+255
-1
lines changed

tr-TR/README-tr_TR.md

Lines changed: 255 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=#20190726><b>26 Temmuz</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=#20190805><b>5 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

@@ -2717,3 +2717,257 @@ function getName(name) {
27172717

27182718
</p>
27192719
</details>
2720+
2721+
---
2722+
2723+
###### <a name=20190805></a>87. Çıktısı Nedir?
2724+
2725+
```javascript
2726+
console.log("I want pizza"[0])
2727+
```
2728+
2729+
- A: `"""`
2730+
- B: `"I"`
2731+
- C: `SyntaxError`
2732+
- D: `undefined`
2733+
2734+
<details><summary><b>Cevap</b></summary>
2735+
<p>
2736+
2737+
#### Cevap: B
2738+
2739+
Bir string içindeki belli bir indeksteki karakteri almak için, köşeli parantez notasyonunu kullanabilirsiniz. String içindeki ilk karakterin indeksi 0'dır, ve böylece devam eder. Bu örnekte indeksi 0 olan elemanı istiyoruz, `"I"` karakteri, loglanır.
2740+
2741+
Bu yöntemin IE7 ve altında desteklenmediğine dikkat edin. Bu durumda, `.charAt()` kullanabilirsiniz.
2742+
2743+
</p>
2744+
</details>
2745+
2746+
---
2747+
2748+
###### 88. Çıktısı Nedir?
2749+
2750+
```javascript
2751+
function sum(num1, num2 = num1) {
2752+
console.log(num1 + num2)
2753+
}
2754+
2755+
sum(10)
2756+
```
2757+
2758+
- A: `NaN`
2759+
- B: `20`
2760+
- C: `ReferenceError`
2761+
- D: `undefined`
2762+
2763+
<details><summary><b>Cevap</b></summary>
2764+
<p>
2765+
2766+
#### Cevap: B
2767+
2768+
You can set a default parameter's value equal to another parameter of the function, as long as they've been defined _before_ the default parameter. We pass the value `10` to the `sum` function. If the `sum` function only receives 1 argument, it means that the value for `num2` is not passed, amd the value of `num1` is equal to the passed value `10` in this case. The default value of `num2` is the value of `num1`, which is `10`. `num1 + num2` returns `20`.
2769+
2770+
If you're trying to set a default parameter's value equal to a parameter which is defined _after_ (to the right), the parameter's value hasn't been initialized yet, which will throw an error.
2771+
2772+
</p>
2773+
</details>
2774+
2775+
---
2776+
2777+
###### 89. Çıktısı Nedir?
2778+
2779+
```javascript
2780+
// module.js
2781+
export default () => "Hello world"
2782+
export const name = "Lydia"
2783+
2784+
// index.js
2785+
import * as data from "./module"
2786+
2787+
console.log(data)
2788+
```
2789+
2790+
- A: `{ default: function default(), name: "Lydia" }`
2791+
- B: `{ default: function default() }`
2792+
- C: `{ default: "Hello world", name: "Lydia" }`
2793+
- D: Global object of `module.js`
2794+
2795+
<details><summary><b>Cevap</b></summary>
2796+
<p>
2797+
2798+
#### Cevap: A
2799+
2800+
With the `import * as name` syntax, we import _all exports_ from the `module.js` file into the `index.js` file as a new object called `data` is created. In the `module.js` file, there are two exports: the default export, and a named export. The default export is a function which returns the string `"Hello World"`, and the named export is a variable called `name` which has the value of the string `"Lydia"`.
2801+
2802+
The `data` object has a `default` property for the default export, other properties have the names of the named exports and their corresponding values.
2803+
2804+
</p>
2805+
</details>
2806+
2807+
---
2808+
2809+
###### 90. Çıktısı Nedir?
2810+
2811+
```javascript
2812+
class Person {
2813+
constructor(name) {
2814+
this.name = name
2815+
}
2816+
}
2817+
2818+
const member = new Person("John")
2819+
console.log(typeof member)
2820+
```
2821+
2822+
- A: `"class"`
2823+
- B: `"function"`
2824+
- C: `"object"`
2825+
- D: `"string"`
2826+
2827+
<details><summary><b>Cevap</b></summary>
2828+
<p>
2829+
2830+
#### Cevap: C
2831+
2832+
Classes are syntactical sugar for function constructors. The equivalent of the `Person` class as a function constructor would be:
2833+
2834+
```javascript
2835+
function Person() {
2836+
this.name = name
2837+
}
2838+
```
2839+
2840+
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"`.
2841+
2842+
</p>
2843+
</details>
2844+
2845+
---
2846+
2847+
###### 91. Çıktısı Nedir?
2848+
2849+
```javascript
2850+
let newList = [1, 2, 3].push(4)
2851+
2852+
console.log(newList.push(5))
2853+
```
2854+
2855+
- A: `[1, 2, 3, 4, 5]`
2856+
- B: `[1, 2, 3, 5]`
2857+
- C: `[1, 2, 3, 4]`
2858+
- D: `Error`
2859+
2860+
<details><summary><b>Cevap</b></summary>
2861+
<p>
2862+
2863+
#### Cevap: D
2864+
2865+
The `.push` method returns the _new length_ of the array, not the array itself! By setting `newList` equal to `[1, 2, 3].push(4)`, we set `newList` equal to the new length of the array: `4`.
2866+
2867+
Then, we try to use the `.push` method on `newList`. Since `newList` is the numerical value `4`, we cannot use the `.push` method: a TypeError is thrown.
2868+
2869+
</p>
2870+
</details>
2871+
2872+
---
2873+
2874+
###### 92. Çıktısı Nedir?
2875+
2876+
```javascript
2877+
function giveLydiaPizza() {
2878+
return "Here is pizza!"
2879+
}
2880+
2881+
const giveLydiaChocolate = () => "Here's chocolate... now go hit the gym already."
2882+
2883+
console.log(giveLydiaPizza.prototype)
2884+
console.log(giveLydiaChocolate.prototype)
2885+
```
2886+
2887+
- A: `{ constructor: ...}` `{ constructor: ...}`
2888+
- B: `{}` `{ constructor: ...}`
2889+
- C: `{ constructor: ...}` `{}`
2890+
- D: `{ constructor: ...}` `undefined`
2891+
2892+
<details><summary><b>Cevap</b></summary>
2893+
<p>
2894+
2895+
#### Cevap: D
2896+
2897+
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`.
2898+
2899+
</p>
2900+
</details>
2901+
2902+
---
2903+
2904+
###### 93. Çıktısı Nedir?
2905+
2906+
```javascript
2907+
const person = {
2908+
name: "Lydia",
2909+
age: 21
2910+
}
2911+
2912+
for (const [x, y] of Object.entries(person)) {
2913+
console.log(x, y)
2914+
}
2915+
```
2916+
2917+
- A: `name` `Lydia` and `age` `21`
2918+
- B: `["name", "Lydia"]` and `["age", 21]`
2919+
- C: `["name", "age"]` and `undefined`
2920+
- D: `Error`
2921+
2922+
<details><summary><b>Cevap</b></summary>
2923+
<p>
2924+
2925+
#### Cevap: A
2926+
2927+
`Object.entries(person)` returns an array of nested arrays, containing the keys and objects:
2928+
2929+
`[ [ 'name', 'Lydia' ], [ 'age', 21 ] ]`
2930+
2931+
Using the `for-of` loop, we can iterate over each element in the array, the subarrays in this case. We can destructure the subarrays instantly in the for-of loop, using `const [x, y]`. `x` is equal to the first element in the subarray, `y` is equal to the second element in the subarray.
2932+
2933+
The first subarray is `[ "name", "Lydia" ]`, with `x` equal to `"name"`, and `y` equal to `"Lydia"`, which get logged.
2934+
The second subarray is `[ "age", 21 ]`, with `x` equal to `"age"`, and `y` equal to `21`, which get logged.
2935+
2936+
</p>
2937+
</details>
2938+
2939+
---
2940+
2941+
###### 94. Çıktısı Nedir?
2942+
2943+
```javascript
2944+
function getItems(fruitList, ...args, favoriteFruit) {
2945+
return [...fruitList, ...args, favoriteFruit]
2946+
}
2947+
2948+
getItems(["banana", "apple"], "pear", "orange")
2949+
```
2950+
2951+
- A: `["banana", "apple", "pear", "orange"]`
2952+
- B: `[["banana", "apple"], "pear", "orange"]`
2953+
- C: `["banana", "apple", ["pear"], "orange"]`
2954+
- D: `SyntaxError`
2955+
2956+
<details><summary><b>Cevap</b></summary>
2957+
<p>
2958+
2959+
#### Cevap: D
2960+
2961+
`...args` is a rest parameter. The rest parameter's value is an array containing all remaining arguments, **and can only be the last parameter**! In this example, the rest parameter was the second parameter. This is not possible, and will throw a syntax error.
2962+
2963+
```javascript
2964+
function getItems(fruitList, favoriteFruit, ...args) {
2965+
return [...fruitList, ...args, favoriteFruit]
2966+
}
2967+
2968+
getItems(["banana", "apple"], "pear", "orange")
2969+
```
2970+
2971+
The above example works. This returns the array `[ 'banana', 'apple', 'orange', 'pear' ]`
2972+
</p>
2973+
</details>

0 commit comments

Comments
 (0)