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 findConsecutiveRuns (arr) { | |
const runs = []; | |
for (let i = 0; i < arr.length; i++) { | |
const curr = arr[i]; | |
const next = arr[i+1]; | |
const last = arr[i+2]; | |
if ( Math.abs(next - curr) == 1 && Math.abs(curr - last) == 2 ) { | |
runs.push(i); | |
} | |
} |
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 arith = { | |
add: function(arg1, arg2, cb){ | |
console.log(arguments); | |
var success = arg1 + arg2; | |
return cb(success); | |
}, | |
substract: function(arg1, arg2){ | |
return arg1 - arg2; | |
}, | |
multiply: function(arg1, arg2){ |
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 verifynumber = function(num){ | |
var number = num.toString(); | |
if(number.length !== 13){ | |
console.log('invalid phone number'); | |
return false; | |
} else { | |
var get234 = number.substring(0,3); | |
if(get234 === "234"){ | |
console.log("good people, great nation"); | |
return 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 Person = function(name){ | |
this.name = name; | |
this.age = 20; | |
this.nationality = "Nigerian" | |
}; | |
Person.prototype.getInfo = function(){ | |
console.log(this.name + "(" + this.age +" yrs old)" + " is a " + this.nationality); | |
} |