Skip to content

Instantly share code, notes, and snippets.

// 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);
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]];
}
}
}
};
const arr = [1, 2, 3, 4, 5, 6];
let rt = 0;
for (let i = 0; i <= arr.length; i++) {
rt += i;
}
console.log(rt)