Skip to content

Instantly share code, notes, and snippets.

@muratatak77
Last active May 31, 2019 00:48
Show Gist options
  • Save muratatak77/dd7007d4b2e32b0bbab7ca9d4b1f9a3e to your computer and use it in GitHub Desktop.
Save muratatak77/dd7007d4b2e32b0bbab7ca9d4b1f9a3e to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/kovuhep - spread marker
<!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 sumUp(...toAdd) {
console.log("toAdd : ", toAdd)
let result = 0;
for (let i = 0; i < toAdd.length; i++){
result += toAdd[i]
}
return result;
}
total = sumUp(100,10,"20")
console.log(total);
</script>
<script id="jsbin-source-javascript" type="text/javascript">
function sumUp(...toAdd) {
console.log("toAdd : ", toAdd)
let result = 0;
for (let i = 0; i < toAdd.length; i++){
result += toAdd[i]
}
return result;
}
total = sumUp(100,10,"20")
console.log(total);
</script></body>
</html>
function sumUp(...toAdd) {
console.log("toAdd : ", toAdd)
let result = 0;
for (let i = 0; i < toAdd.length; i++){
result += toAdd[i]
}
return result;
}
total = sumUp(100,10,"20")
console.log(total);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment