Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Study</title>
- </head>
- <body>
- <script>
- 'use strict'
- function sayHi() {
- alert("Hello, from JS function!");
- }
- function addOne(val) {
- alert(`Add ONE! - ${++val}`);
- }
- function maxNumInt(numA, numB, interactive = true) {
- if (interactive) {
- numA = +prompt("Enter numA");
- numB = +prompt("Enter numB");
- }
- let result = (numA > numB) ? numA : numB;
- if (interactive) {
- alert(`max num is ${result}`);
- }
- return result;
- }
- function max(numA, numB) {
- return (numA > numB) ? numA : numB;
- }
- function retTester(boundary, base) {
- let sum = base;
- for (let i = 0; i < 100; ++i) {
- console.log(`inside loop - ${i}`);
- sum += i;
- if (i == boundary) {
- console.log(`Boundary reached :(`);
- return;
- }
- if (sum > 30) {
- console.log(`Sum is TOOO BIG :( - ${sum}`);
- return;
- }
- }
- }
- // let A = +prompt("Enter A");
- // let B = +prompt("Enter B");
- //console.log(maxNum(10, 38));
- // let res = maxNum(10, 38);
- //maxNumBAD();
- maxNumInt(0, 0 , false);
- let res = maxNumInt(10, 38, false);
- console.log(res);
- //retTester(12, -10000);
- //let res = maxNum(42, 245);
- //alert(`res is - ${res}`);
- //for (let i = 0; i < 5; ++i) {
- // sayHi();
- //}
- //addOne(+prompt("Enter value for addOne"));
- //addOne();
- //
- //let num1 = +prompt("Enter first number");
- //let sum1 = 0;
- //for (sum1 = 0; num1; sum1 += num1 % 10, num1 = Math.floor(num1 / 10));
- //// further work
- //let num2 = +prompt("Enter second number");
- //let sum2 = 0;
- //for (sum2 = 0; num2; sum2 += num2 % 10, num2 = Math.floor(num2 / 10));
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement