|
@@ -11,7 +11,7 @@ function cube(x){
|
|
return x**3;
|
|
return x**3;
|
|
}
|
|
}
|
|
|
|
|
|
- let result = cube();
|
|
|
|
|
|
+cube();
|
|
|
|
|
|
// avg2
|
|
// avg2
|
|
|
|
|
|
@@ -19,12 +19,42 @@ function avg2(a,b){
|
|
return (a + b)/2
|
|
return (a + b)/2
|
|
}
|
|
}
|
|
|
|
|
|
-let result1 = avg2();
|
|
|
|
|
|
+avg2();
|
|
|
|
|
|
// sum3
|
|
// sum3
|
|
|
|
|
|
function sum3(a,b,c){
|
|
function sum3(a,b,c){
|
|
- return (a + b + c) || (a + b) || (b + c) || (a + c)
|
|
|
|
|
|
+ return (a + b + c) || (a + b)
|
|
}
|
|
}
|
|
-let result2 = sum3()
|
|
|
|
|
|
+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()
|
|
|
|
|