Created
September 1, 2017 06:54
-
-
Save dharavp/c0772ccd811f8a91267e49fc92f7e570 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/wahoralani
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
<!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"> | |
'use strict'; | |
var mul = function mul() { | |
console.log(arguments); | |
}; | |
mul(2, 3, 4, 5); | |
//sum of all dynamic array item | |
var sum = function sum() { | |
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
return args.reduce(function (prev, curr) { | |
return prev + curr; | |
}); | |
}; | |
console.log(sum(2, 3, 4, 5)); | |
//find max number from array | |
var number = [4, 3, 2, 8]; | |
var max = Math.max.apply(null, number); | |
console.log(max); | |
//concat two array | |
var numbers = [4, 6, 3, 8]; | |
var newNumbers = [3, 4, 6].concat(numbers, [7, 2]); | |
console.log(newNumbers); | |
//Destructuring | |
var person = { name: 'abc', | |
age: 30 }; | |
var personAge = person.age; | |
console.log(personAge); | |
var arrayNumber = [3, 5, 6, 7, 8]; | |
var first = arrayNumber[0]; | |
var remaining = arrayNumber.slice(1); | |
console.log(first, remaining); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">let mul=function(){ | |
console.log(arguments); | |
}; | |
mul(2,3,4,5); | |
//sum of all dynamic array item | |
let sum = function(...args){ | |
return args.reduce((prev,curr) => prev+curr); | |
}; | |
console.log((sum(2,3,4,5))); | |
//find max number from array | |
let number=[4,3,2,8]; | |
let max = Math.max.apply(null,number); | |
console.log(max); | |
//concat two array | |
let numbers=[4,6,3,8]; | |
let newNumbers=[3,4,6,...numbers,7,2]; | |
console.log(newNumbers); | |
//Destructuring | |
let person = {name:'abc', | |
age:30}; | |
let {age:personAge} = person; | |
console.log(personAge); | |
let arrayNumber = [3,5,6,7,8]; | |
let[first,...remaining]=arrayNumber; | |
console.log(first,remaining);</script></body> | |
</html> |
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
'use strict'; | |
var mul = function mul() { | |
console.log(arguments); | |
}; | |
mul(2, 3, 4, 5); | |
//sum of all dynamic array item | |
var sum = function sum() { | |
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
return args.reduce(function (prev, curr) { | |
return prev + curr; | |
}); | |
}; | |
console.log(sum(2, 3, 4, 5)); | |
//find max number from array | |
var number = [4, 3, 2, 8]; | |
var max = Math.max.apply(null, number); | |
console.log(max); | |
//concat two array | |
var numbers = [4, 6, 3, 8]; | |
var newNumbers = [3, 4, 6].concat(numbers, [7, 2]); | |
console.log(newNumbers); | |
//Destructuring | |
var person = { name: 'abc', | |
age: 30 }; | |
var personAge = person.age; | |
console.log(personAge); | |
var arrayNumber = [3, 5, 6, 7, 8]; | |
var first = arrayNumber[0]; | |
var remaining = arrayNumber.slice(1); | |
console.log(first, remaining); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment