Javascript

Variables


Summary

This page shows examples of how to declare and use variables in Javascript.

Discussion

  • Declaring variables: var myVariable = ["item", 2, 4, "stuff"];

  • Data types:

    • string: "stuff"
    • integer: 42
    • float: 3.14
    • bool: false
    • array: ["things", "go", "here"]
  • Access items in an array through indices: myArray[0];

Examples

  • String: var myString = 'hello';
  • integer: var myInt = 42;
  • float: var myFloat = 3.14;
  • bool: var myBool = false;
  • array: var myArray = ["things", "go", "here"];

References

results matching ""

    No results matching ""