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
| // 1 | |
| let n = 3; | |
| if (n % 2 === 0) console.log("even"); | |
| else console.log("odd"); | |
| // 2 | |
| let age = 7; | |
| let minAge = 7; | |
| let maxAge = 12; | |
| if (age >= minAge && age <= maxAge) console.log(true); |
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
| var twoSum = function(nums, target) { | |
| for (let i = 0; i < nums.length; i++){ | |
| for (let j = 0; j < nums.length; j++){ | |
| if(nums[i] + nums[j] == target && i !=j) { | |
| return [nums[i], nums[j]]; | |
| } | |
| } | |
| } | |
| }; |
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 arr = [1, 2, 3, 4, 5, 6]; | |
| let rt = 0; | |
| for (let i = 0; i <= arr.length; i++) { | |
| rt += i; | |
| } | |
| console.log(rt) |
NewerOlder