Need Assistance? 01384 442752 (UK)

What is Javascript

What Is JavaScript?

JavaScript is by far the most popular and widely used scripting language on the internet. It was invented by Brendan Eich at Netscape and has appeared in Netscape and Microsoft browsers since 1996. JavaScript has since grew in popularity and is now supported by all the major internet browsers (i.e. Internet Explorer, Firefox, Safari, Opera and Chrome).

 JavaScript is a scripting language which was designed to add more interactive features to static HTML pages. You may have seen some features on websites while browsing the internet such as mouse trailers, popup windows, drop down menus, countdown timers, embedded clocks, etc.; these are all developed using JavaScript. The JavaScript code is usually embedded in the HTML code and runs on the user’s browser, that’s why JavaScript is known as a client-side scripting language. However, the main downside of having a script running on the browser and the code embedded in HTML is that everybody can download and view the code, without the need for a license. Client-side and server-side scripting will be explained at the end of this lesson in more details.

JavaScript is a powerful scripting language which can be used to read and modify HTML elements, validate data, and it can also react to events such as a mouse click or a key press on the keyboard, etc.

Enabling JavaScript in Browsers
Before running any JavaScript code on your computer, you need to ensure that JavaScript has been enabled to run on the internet browser you will be using. The following sections explain how to enable JavaScript on Internet Explorer, Firefox and Opera.
Will You Cope with Learning Computer Programming?
Try reading the following extract from this course. If this is challenging but not totally confusing to you; this course could be an ideal place to begin learning programming.

JavaScript is a programming language which contains a wide range of operator, similar to most other programming languages.

The following are the most important categories of code (or operators).
  • Arithmetic operators,
  • Assignment operators,
  • Unary operators;
  • Conditional operators,
  • Comparison operators,
  • String operators,
  • Logical operators.
Arithmetic Operators
As their name implies, arithmetic operators are used to perform arithmetic operations on values and variables, in JavaScript programming. The most important arithmetic operators in JavaScript are +, -, * and /. When any of these operators is used in an expression, it should have values at the right and left side known as operands. For example: age = 2010 – 1983; is a JavaScript expression which contains the minus (-) arithmetic operator, the two operands 2010 and 1983, and the assignment operator (=). (Note that the assignment operator will be discussed in the next section). In this example, the minus operator is subtracting the value of 1983 from the value of 2010.

In general, the arithmetic operators are used as follows:

x + y;
x – y;
x * y;
x / y;
x % y.

Note that the % operator is the modulus operator (commonly known as the “mod operator”). It is used to divide the left hand operand by the right hand operand and returns the remainder of the division.

Assignment Operators
The most basic assignment operator is the “=” (equal) operator. It is used in most programming languages to assign a value to a variable. That’s why it is known as an “assignment operator”. For example, if you want to assign the value 25 to the variable “age”, you can do this simply by using the assignment operator, as follows: age = 25.

There are other assignment operators available, such as the +=, -=, *=, /= and %=. These operators combine arithmetic operators with the assignment operator to form operators in a compact form. These combined operators are used to perform an arithmetic operation on the value before it gets assigned to the variable.

For example, if you want to add the value 50 to the variable “age” and store the result in “age”, you can do this as follows: age = age + 25. This operation is also possible while using the combined += assignment operator available, as follows: age += 25.

So in general, a = a + b can be replaced by a += b.

We can apply the same logic to the other operators, as follows:

x = x + y is equivalent to x += y;
x = x - y is equivalent to x -= y;
x = x * y is equivalent to x *= y;
x = x / y is equivalent to x /= y;
x = x % y is equivalent to x %= y.

Read a book, do a course, join an organisation; talk to people who know about computers.
Contact us -Talk to an Academic Officer
Learn from our experience.

[26/01/2021 02:02:13]