The language syntax is basically a means of communication. In a programming language, it's a formal way of communicating with algorithms, from both algorithms to programmer and programmer to machine. This is because a machine works on given instructions.
These instructions are meant to be written in a specific format, so that a machine could understand and compile it properly. That specific format is defined by some general rules of a programming language, known as language syntax.
A computer contains a list of instructions to be executed. Every computer language has different syntax and rules. To use different languages, we must have knowledge of their language syntax, such as the following:
Similarly, other languages in JavaScript have a unique syntax. JavaScript is not a language of Java; these are two different languages and the syntaxes for both languages are different. JavaScript is a powerful and expressive language. JavaScript's statements are separated by a semicolon at the end.
The JavaScript language syntax is much easy for beginners who have an idea of object-oriented programming. JavaScript is contained between the <scripts>…</script>
tags. These are treated as HTML tags in any web browser.
You can place your JavaScript code anywhere on your webpage, but I prefer the way of defining your script using the <head>
tag. So, the structure of your script will be as follows:
<head> <script> …………….. </script> </head>
Basically, the <script>
tag when written writing <head>
tag, tells the browser that this scripts need to be executed first when the web page loads. Although, its a good practice to include javaScript is to place it at the bottom of a web page. There are two important attributes of this script
tag.
3.15.3.167