Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="description" content="assignment">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- /* 1. Assignment Operators:
- * Assignment is exactly what it sounds like. You are assigning a value
- * to a variable. The most obvious is the = assignment, but there are several others
- * which I will demonstrate.
- */
- //Assignment
- var tool = "hammer";
- //Addition assignment
- var greeting = "Hello";
- var job = " Nurse!";
- greeting += job; //This will print the string "Hello Nurse!" to the console.
- //Subtraction assignment
- var flop = 10;
- var flip = 24;
- flop -= flip; //This will print -14.
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">/* 1. Assignment Operators:
- * Assignment is exactly what it sounds like. You are assigning a value
- * to a variable. The most obvious is the = assignment, but there are several others
- * which I will demonstrate.
- */
- //Assignment
- var tool = "hammer";
- //Addition assignment
- var greeting = "Hello";
- var job = " Nurse!";
- greeting += job; //This will print the string "Hello Nurse!" to the console.
- //Subtraction assignment
- var flop = 10;
- var flip = 24;
- flop -= flip; //This will print -14.
- </script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement