Advertisement
Guest User

Untitled

a guest
Feb 6th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // TODO: Help command
  2. function help(str){
  3.   if (str == sq) {
  4.     console.log("function sq squares your number, and only take one argument of type interger");
  5.   } else if (str == cube) {
  6.     console.log("function cube cubes your number, and only take one argument of type interger");
  7.   } else if (str == repeatMe) {
  8.     console.log("function repeatMe repeats what you say in an alert, and only take one argument of type string");
  9.   } else {
  10.   console.log("thanks for typing in help, currently this website only has 3 console programs:");
  11.   console.log("--> sq()");
  12.   console.log("--> cube()");
  13.   console.log("--> repeatMe()");
  14.   console.log("To know more info, type help and in the brackets put the program name without the brackets");
  15.   console.log("e.g.");
  16.   console.log("help(repeatMe)");
  17.   }
  18.  
  19. }
  20.  
  21.  
  22. // Square numbers
  23. // Take only one argument of type integer
  24. function sq(x){
  25.   return x * x;
  26. }
  27.  
  28. // Cube numbers
  29. // Takes only one argument of type integer
  30. function cube(x){
  31.   return x * x * x;
  32. }
  33.  
  34. // Repeat yourself
  35. // Take only one argument of type string
  36. function repeatMe(str){
  37.   alert(str);
  38. }
  39.  
  40. function devNote(userName,password){
  41.   if (userName == "dev" && password == "devaccess") {
  42.     console.log("welcome to dev access");
  43.     console.log("this place is to show that only people who are developers can access this place");
  44.     console.log("src code avail at ");
  45.   }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement