pavlovm503 %!s(int64=4) %!d(string=hai) anos
pai
achega
01c8b0e5ff
Modificáronse 2 ficheiros con 75 adicións e 0 borrados
  1. 11 0
      Pavlov_hm6/inddex.html
  2. 64 0
      Pavlov_hm6/script/script.js

+ 11 - 0
Pavlov_hm6/inddex.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Pavlov_Maik_FSA3</title>
+</head>
+<body>
+
+	<script src="script/script.js"></script>
+</body>
+</html>

+ 64 - 0
Pavlov_hm6/script/script.js

@@ -0,0 +1,64 @@
+//a
+function a(hi){
+    alert(hi)
+}
+a("Привет!") // вызывает alert("Привет!")
+//cube
+function greet(step){
+   var stepin = step**3
+   console.log(stepin)
+}
+greet(prompt("введите число для возвидения в третью степень", "число"))
+//avg2
+function average (a,b){
+  let avg2 = (a+b)/2
+  console.log(avg2)
+}
+average(1,2)
+average(5,10)
+//sum3
+function sumTree (a=0,b=0,c=0){
+  let sum3 = a+b+c
+  console.log(sum3)
+}
+sumTree(1,2,3)
+sumTree(5,10,100500)
+sumTree(5,10)
+//greetAll
+function userName(a, b, c) {
+  arguments[0]=prompt("What u name","Superman");
+  alert(`Hellow ${arguments[0]} `);
+  arguments[1]=prompt("What u surName","SpiderMan");
+  alert(`Hellow ${arguments[0]}, ${arguments[1]}`);
+  arguments[2]=prompt("What u fatherName","Captain Obvious");
+  alert(`Hellow ${arguments[0]}, ${arguments[1]}, ${arguments[2]}`);
+};
+userName();
+//sum
+function sum() {
+  var fullSum = 0;
+  for (var i = 0; i < arguments.length; i++) {
+    fullSum += arguments[i];
+  }
+  console.log(fullSum)
+  return fullSum;
+}
+sum(1)
+sum(2)
+sum(10,20,40,100)
+//union
+var unionCheck = prompt("Введите название задания")
+switch (unionCheck.toLowerCase()){
+    case "a": a()
+              break
+    case "cube": greet()
+              break
+    case "avg2": average()
+              break
+    case "sum3": sumTree()
+              break
+    case "greetAll": userName()
+              break
+    case "sum": sum()
+              break
+}