Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="description" content="assignment">
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width">
  7. <title>JS Bin</title>
  8. </head>
  9. <body>
  10.  
  11. <script id="jsbin-javascript">
  12. /* 1. Assignment Operators:
  13. * Assignment is exactly what it sounds like. You are assigning a value
  14. * to a variable. The most obvious is the = assignment, but there are several others
  15. * which I will demonstrate.
  16. */
  17.  
  18. //Assignment
  19. var tool = "hammer";
  20.  
  21. //Addition assignment
  22. var greeting = "Hello";
  23. var job = " Nurse!";
  24. greeting += job; //This will print the string "Hello Nurse!" to the console.
  25.  
  26. //Subtraction assignment
  27. var flop = 10;
  28. var flip = 24;
  29.  
  30. flop -= flip; //This will print -14.
  31. </script>
  32.  
  33.  
  34.  
  35. <script id="jsbin-source-javascript" type="text/javascript">/* 1. Assignment Operators:
  36. * Assignment is exactly what it sounds like. You are assigning a value
  37. * to a variable. The most obvious is the = assignment, but there are several others
  38. * which I will demonstrate.
  39. */
  40.  
  41. //Assignment
  42. var tool = "hammer";
  43.  
  44. //Addition assignment
  45. var greeting = "Hello";
  46. var job = " Nurse!";
  47. greeting += job; //This will print the string "Hello Nurse!" to the console.
  48.  
  49. //Subtraction assignment
  50. var flop = 10;
  51. var flip = 24;
  52.  
  53. flop -= flip; //This will print -14.
  54.  
  55.  
  56. </script></body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement