Last active
March 2, 2018 14:24
-
-
Save ShahinAhmed7/967d477879cfb1bafd80d8e6e334a234 to your computer and use it in GitHub Desktop.
ES6 loop-array// source http://jsbin.com/weganat
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> | |
<script src="http://fb.me/react-with-addons-0.14.0.js"></script> | |
<script src="http://fb.me/react-dom-0.14.0.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id=example></div> | |
<h1>Hello world</h1> | |
<script id="jsbin-javascript"> | |
//jshint esnext:true | |
"use strict"; | |
function deposit() { | |
for (var _len = arguments.length, money = Array(_len), _key = 0; _key < _len; _key++) { | |
money[_key] = arguments[_key]; | |
} | |
console.log(money); | |
var balance = 0; | |
for (var i = 0; i < money.length; i++) { | |
balance += money[i]; | |
} | |
return balance; | |
} | |
console.log(deposit(100, 40, 50, 30)); | |
var addMoney = [34, 66, 99, 24, 36]; | |
console.log.apply(console, addMoney); | |
console.log(Math.max.apply(Math, addMoney)); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//fb.me/react-with-addons-0.14.0.js"><\/script> | |
<script src="//fb.me/react-dom-0.14.0.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id=example></div> | |
<h1>Hello world</h1> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
//jshint esnext:true | |
function deposit(...money){ | |
console.log(money); | |
let balance = 0; | |
for(let i = 0; i < money.length; i++){ | |
balance += money[i]; | |
} | |
return balance; | |
} | |
console.log(deposit(100, 40, 50, 30)); | |
let addMoney = [34, 66, 99, 24, 36]; | |
console.log(...addMoney); | |
console.log(Math.max(...addMoney));</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
//jshint esnext:true | |
"use strict"; | |
function deposit() { | |
for (var _len = arguments.length, money = Array(_len), _key = 0; _key < _len; _key++) { | |
money[_key] = arguments[_key]; | |
} | |
console.log(money); | |
var balance = 0; | |
for (var i = 0; i < money.length; i++) { | |
balance += money[i]; | |
} | |
return balance; | |
} | |
console.log(deposit(100, 40, 50, 30)); | |
var addMoney = [34, 66, 99, 24, 36]; | |
console.log.apply(console, addMoney); | |
console.log(Math.max.apply(Math, addMoney)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment