Guest User

Untitled

a guest
Apr 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. 'use strict';
  2.  
  3. console.log(100 + 10); // 110
  4. console.log(100 - 10); // 90
  5. console.log(100 * 10); // 1000
  6. console.log(100 / 10); // 10
  7. console.log(100 % 10); // 0
  8.  
  9. console.log("hello world"); // 'hello world'
  10. console.log("9"); // '9'
  11. console.log("9" + 1); // '91'
  12.  
  13. let number = 100;
  14. let number2 = 10;
  15.  
  16. console.log(number + number2); // 110
  17. console.log(number - number2); // 90
  18. console.log(number * number2); // 1000
  19. console.log(number / number2); // 10
  20. console.log(number % number2); // 0
  21.  
  22. let string = "hello";
  23.  
  24. console.log(string); // "hello"
  25.  
  26. function add (one, two) {
  27. return one + two;
  28. }
  29.  
  30. let ten = add(5, 5); // 10
  31.  
  32. console.log(ten); // 10
  33.  
  34. function capitalize (string) {
  35. console.log(string.toUpperCase());
  36. }
  37.  
  38. capitalize(string); //HELLO
  39.  
  40. let tru = true;
  41. let fal = false;
  42.  
  43. console.log(tru);
  44. console.log(fal);
  45.  
  46. // === asks if the two things are "the same"
  47.  
  48. if (tru === true) { // true is equal / "the same" to true so it prints 'tru is true'
  49. console.log("tru is true"); // 'true is tru'
  50. }
  51.  
  52. if (fal === true) { // nothing occurs because fal isn't true
  53. console.log("fal is true"); // nothing
  54. }
  55.  
  56. function isOdd (number) {
  57. return (number % 2 === 1);
  58. }
  59.  
  60. let question = isOdd(2);
  61.  
  62. console.log(question);
  63.  
  64. if (isOdd(7)) {
  65. console.log('7 is an odd number');
  66. }
Add Comment
Please, Sign In to add comment