123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- // a
- function a(){
- alert("Hello")
- }
- a();
- // cube
- function cube(x){
- return x**3;
- }
-
- cube();
- // avg2
- function avg2(a,b){
- return (a + b)/2
- }
- avg2();
- // sum3
- function sum3(a,b,c){
- return (a + b + c) || (a + b)
- }
- sum3();
- // intRandom
- function intRandom(a,b) {
- if(b === undefined){
- c = (Math.round(Math.random() *a))
- }else
- c = (Math.round(Math.random() * (b - a) + a));
- return c
- }
- intRandom()
- // greetAll ?
- function greetAll(){
- for(i = 0;i<arguments.length;i++){
- alert(`Hi, ${arguments[i]}`)};
- }
- greetAll()
- // sum
- function sum(){
- let result = 0;
- for(i = 0;i<arguments.length;i++){
- result += arguments[i]};
- return result
- }
- sum()
|