Skip to content

Instantly share code, notes, and snippets.

View periakteon's full-sized avatar

Masum Gökyüz periakteon

View GitHub Profile
@periakteon
periakteon / stand-in-line.js
Last active March 13, 2023 11:29
Stand in Line
function nextInLine(arr, item) {
return item;
}
let testArr = [1, 2, 3, 4, 5];
console.log("Before: " + JSON.stringify(testArr));
// Before: [1,2,3,4,5]
console.log(nextInLine(testArr, 6));
// 6
@periakteon
periakteon / stand-in-line-solution.js
Last active March 13, 2023 11:47
stand-in-line-solution.js
function nextInLine(arr, item) {
//Argüman olarak verilecek olan "item"ı, yani sayıyı array'in sonuna ekliyoruz
arr.push(item);
//array'in ilk elemanını siliyoruz ve silinen elemanı döndürüyoruz
return arr.shift();
}
//testArr adında bir dizi oluşturuyoruz
@periakteon
periakteon / boolean-values.js
Created March 13, 2023 12:06
FCC: Understanding Boolean Values
function welcomeToBooleans() {
// Only change code below this line
return false; // Change this line
// Only change code above this line
}
@periakteon
periakteon / boolean-values-solution.js
Created March 13, 2023 12:24
FCC: Understanding Boolean Values
function welcomeToBooleans() {
return true; // Döndürülen değeri "true" olarak değiştirdik.
}
@periakteon
periakteon / if-statements-example.js
Created March 13, 2023 13:13
FreeCodeCamp: If Statements (Example)
function test (myCondition) {
if (myCondition) {
return "It was true";
}
return "It was false";
}
test(true);
test(false);
@periakteon
periakteon / if-statements-solution.js
Last active March 13, 2023 13:40
FreeCodeCamp: If Statements Solution
function trueOrFalse(wasThatTrue) {
//eğer koşul sağlanıyorsa
if (wasThatTrue) {
return "Yes, that was true";
}
//eğer koşul sağlanmıyorsa
return "No, that was false";
}
@periakteon
periakteon / comparison-with-equality-example.js
Created March 13, 2023 13:56
FreeCodeCamp: Comparison with the Equality Operator (Example)
function equalityTest(myVal) {
if (myVal == 10) {
return "Equal";
}
return "Not Equal";
}
@periakteon
periakteon / type-coercion.js
Created March 13, 2023 14:03
FreeCodeCamp: Type Coercion
1 == 1 // true
1 == 2 // false
1 == '1' // true
"3" == 3 // true
@periakteon
periakteon / comparison-with-equality-solution.js
Last active March 13, 2023 14:29
FreeCodeCamp: Comparison with Equality Operator
function testEqual(val) {
if (val == 12) {
return "Equal";
}
return "Not Equal";
}
console.log(testEqual(12));
//Equal
@periakteon
periakteon / strict-equality-example.js
Created March 13, 2023 14:19
FreeCodeCamp: Strict Equality (Example 1)
3 === 3 // true
3 === '3' // false çünkü '3' bir string değeri