JavaScript syntax quick reference guide

If you know the basics of JavaScript, you can skip this section. Here is a quick overview of JavaScript:

  • Use the keyword var to define a variable:
    var myAge = 31;
  • Use // for inline comments and /* */ for multiline comments:
    // this is an inline comment
    /* this
    is a
    multi-line
    comment
    */
  • Conditional statements:
    if (myAge > 29) {
      console.log("I am not in my twenties anymore!");
    } else {
      console.log("I am still in my twenties!");
    }
  • Defining a function:
    function nameOfMyFunction(argument1, argument2) {
      console.log(argument1, argument2);
    }
  • Executing a function:
    nameOfMyFunction("First Value", "Second Value");
  • A function can also behave as a class and have methods, properties, and instances. Properties are accessed through ...

Get Redis Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.