This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findGreater(a, b) { | |
// koşul, yani "a>b" true olduğunda "a is greater" döner, | |
// kalan tüm durumlarda (else), "b is greater or equal" döner. | |
return a > b ? "a is greater" : "b is greater or equal"; | |
} | |
/* | |
The syntax is --> " a ? b : c " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findGreater(a, b) { | |
if(a > b) { | |
return "a is greater"; | |
} | |
else { | |
return "b is greater or equal"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToInteger(str) { | |
return parseInt(str, 2); | |
} | |
console.log(convertToInteger("10011")); | |
// 19 | |
console.log(convertToInteger("111001")); | |
// 57 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToInteger(str) { | |
} | |
convertToInteger("10011"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = parseInt("11", 2); | |
console.log(a); | |
// 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iki parametre alır: (i) string, (ii) radix (taban) | |
parseInt(string, radix); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToInteger(str) { | |
const parsedStr = parseInt(str); | |
return parsedStr; | |
} | |
console.log(convertToInteger("56")); | |
// 56 | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToInteger(str) { | |
} | |
convertToInteger("56"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = parseInt("007"); | |
// a = 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomRange(myMin, myMax) { | |
return Math.floor(Math.random() * (myMax - myMin + 1) + myMin); | |
} | |
console.log(randomRange(5, 10)); | |
// 9 | |
console.log(randomRange(5, 10)); | |
// 10 |