Created
June 27, 2018 13:32
-
-
Save seonatic/b95f983f5a0eef22ae3bdbfbc6adb21e to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/darilaz
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function Person (name, age) { | |
this.name= name; | |
this.age= age; | |
this.getInfo = function(){ | |
console.log(this.name + ' ' + this.age); | |
} | |
} | |
var jam = new Person ('James', 22); | |
jam.getInfo(); | |
let arr = [ 1,3,6,2,4,5,7,8,10]; | |
let sorted = arr.sort( (a,b) => a - b); | |
var x = sorted.find(el => el - 1 !== sorted.indexOf(el))-1; | |
console.log (x); | |
let arr2 = [ 1,3,6,2,4,5,7,8,10]; | |
var b= arr2.reduce (( acc, item) => acc+item); | |
var n= arr2.length+1; | |
var total= (n*(n+1))/2; | |
console.log(total-b); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function Person (name, age) { | |
this.name= name; | |
this.age= age; | |
this.getInfo = function(){ | |
console.log(this.name + ' ' + this.age); | |
} | |
} | |
var jam = new Person ('James', 22); | |
jam.getInfo(); | |
let arr = [ 1,3,6,2,4,5,7,8,10]; | |
let sorted = arr.sort( (a,b) => a - b); | |
var x = sorted.find(el => el - 1 !== sorted.indexOf(el))-1; | |
console.log (x); | |
let arr2 = [ 1,3,6,2,4,5,7,8,10]; | |
var b= arr2.reduce (( acc, item) => acc+item); | |
var n= arr2.length+1; | |
var total= (n*(n+1))/2; | |
console.log(total-b);</script></body> | |
</html> |
This file contains 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 Person (name, age) { | |
this.name= name; | |
this.age= age; | |
this.getInfo = function(){ | |
console.log(this.name + ' ' + this.age); | |
} | |
} | |
var jam = new Person ('James', 22); | |
jam.getInfo(); | |
let arr = [ 1,3,6,2,4,5,7,8,10]; | |
let sorted = arr.sort( (a,b) => a - b); | |
var x = sorted.find(el => el - 1 !== sorted.indexOf(el))-1; | |
console.log (x); | |
let arr2 = [ 1,3,6,2,4,5,7,8,10]; | |
var b= arr2.reduce (( acc, item) => acc+item); | |
var n= arr2.length+1; | |
var total= (n*(n+1))/2; | |
console.log(total-b); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment