As it goes
with ordinary language that you usually use, JavaScript also has language
feature. One of the most important features of JavaScript is the syntax. When
you write the first JavaScript program, you
need to make sure that you understand the basic syntactic function of this
programming language. What makes this language feature is important for
programming? When you use incorrect syntax in real life, the people who receive
it still understand what you mean. They might accidently misinterpret it. In
programming, the result is fatal. Incorrect syntactic use might lead to
dysfunctional program. In this step by step writing for JavaScript syntax, we
are going to talk some of its important elements.
Important Elements for Your First JavaScript
Program
When
making a JavaScript for website, it is important to know the syntactic function
of it. JavaScript program itself is originally designed for computer program.
It developed into complex programming language along with the language feature.
This programming language involves several instructions. The computer will
execute the instructions written in form of JavaScript code. If the instruction
is incorrect in the first place, then the execution might not run as expected.
Here are some JavaScript syntax aspects that you should know better.
1.
White space
Most
people underestimate the white space line on
JavaScript writing. Despite being simple form of JavaScript syntax, it holds
important role on the entire code. The impact of white space on JavaScript is
related to semantic. Some codes require new line of white space in order to
establish new instructions. This new line is also important to make the entire
code readable. Any mistake on the coding will be easily located.
2.
Semicolon
The semicolon rules are also important part of the
JavaScript syntax. If it is not used properly, the program might not run well.
In what occasion do you need to insert semicolon on your code? The semicolon is
mostly used to separate two or more statements located on the same line. This
semicolon use is obligatory. The optional use of semicolon is at the end of
particular statement on the code. Incorrect use of semicolon is if there is
closing curly bracket in front of it. The same situation goes with round
bracket.
3.
Sensitive case
JavaScript
language is case sensitive. It means that the case used on the coding matters.
Several parts of the coding such as variables, functions, keywords,
identifiers, and many more should be written consistently in sensitive case. This language feature is
completely different with HTML. In HTML coding, the case is not sensitive. The
usage of case sensitivity on HTML might be confusing. The same functions on
HTML coding can be written in different case, yet produces the same result.
Aside from
those JavaScript elements, there are still more elements that will bring
influence to the result of the programming. In JavaScript
document write, everything should be written correctly. Aside from being
correct, the coding should also be arranged neatly. It will be helpful during
the editing and searching for errors.
0 komentar:
Posting Komentar