Home >Web Front-end >JS Tutorial >JavaScript Guidelines_Basics
This section is about some other important things to know when coding in JavaScript.
JavaScript is case-sensitive
The function named "myfunction" and the function named "myFunction" are two different functions. Similarly, the variable "myVar" and the variable "myvar" are also different.
JavaScript is case sensitive - so when you create or use variables, objects and functions, please pay attention to the case of characters.
Spaces
JavaScript will ignore extra spaces. So you can add appropriate spaces in the code to make the code more readable. The following two lines are equivalent:
name="Hege"
name = "Hege" Wrap
You can use backslashes inside the string to wrap the code. The following example is correct:
document.write("Hello
World!") but cannot break lines like this:
document.write
("Hello World!" ") Comment:
You can use two slashes to add a comment:
//this is a comment
document.write("Hello World!") You can also use /* and * /: (This can create a multi-line comment block)
/* This is a comment
block. It contains
several lines */
document.write("Hello World!")