Day 72: Learning JavaScript

Hi. I know I have been away again, but I am here now. Had to focus on wrapping up my school project last week and I couldn’t combine both. I am still learning Javascript and here are the 10 things I learnt today:

  1. The -= subtracts a number from a variable.

  2. The *= operator multiplies a variable by a number and the /= operator divides a variable by another number.

  3. When you are defining a string you must start and end with a single or double quote.

  4. In JavaScript, it is possible to escape a quote from considering it as an end-of-string quote by placing a backslash (\) in front of the quote.

  5. String values in JavaScript may be written with single or double quotes, as long as it is started and ended with the same type of quote.

  6. The reason for escape sequence in strings is to allow for use characters which may not otherwise be able to type out, such as a newline and to represent multiple quotes in a string without JavaScript misinterpreting what is meant.

  7. In JavaScript, when the + operator is used with a String value, it is called the concatenation operator.

  8. The += operator can also be used to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.

  9. Sometimes there is a need to build a string. By using the concatenation operator (+), one or more variables can be inserted into a string you're building.

  10. Just as a string is built over multiple lines out of string literals, we can also append variables to a string using the plus equals (+=) operator.