Basic JavaScript Topics

MD. SADIQ
2 min readMay 6, 2021

Here we know about some very basic topics including to or related to JavaScript.

1. Numbers

Values of the type number are, as you might have deduced, numeric values. They are written the way numbers are usually written:

100 + 4 * 11

2. Strings

The next data type is the string. Its use is not as evident from its name as with numbers, but it also fulfills a very basic role. Strings are used to represent text, the name supposedly derives from the fact that it strings together a bunch of characters. Strings are written by enclosing their content in quotes:

"Patch my boat with chewing gum."

3. Boolean values

Then there are values of the boolean type. There are only two of these: true and false.

Here is one way to produce a true value:

3 > 2

And false can be produced like this:

3 < 2

4. Functions

A lot of the values provided by the standard environment have the type function. A function is a piece of program wrapped in a value. Generally, this piece of program does something useful, which can be evoked using the function value that contains it. In a browser environment, the variable alert holds a function that shows a little dialog window with a message.

It is used like this:

alert("Also, your hair is on fire.");

5. for loops

The uses of while we have seen so far all show the same pattern. First, a counter variable is created. This variable tracks the progress of the loop. The while itself contains a check, usually to see whether the counter has reached some boundary yet. Then, at the end of the loop body, the counter is updated.

A lot of loops fall into this pattern. For this reason, JavaScript, and similar languages, also provide a slightly shorter and more comprehensive form:

for (var number = 0; number <= 12; number = number + 2)
alert(number);

Thanks for reading , Next time we will discus better as present.

--

--