INTRO TO THE WORLD OF JAVASCRIPT

narendrapalacharla
3 min readMar 8, 2021

Hello all, This is the first article from the JavaScript series, let us dive into the topic.

If you ask someone “what is JavaScript ?”, They may say ...

JavaScript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else. — MDN Doc’s.

Can we make it simple?

Yes! JavaScript is the soul of web pages, which makes them interactive and dynamic.

JavaScript is used to create interactive websites. it mainly used for Client-side validation, Dynamic drop-down menus, Displaying pop-up windows, and dialog boxes (like an alert dialog box, confirm dialog box, and prompt dialog box).

Prompt is one of the examples of how JavaScript interactivity works.

Let us dive into actual learning:

There are three locations to place JavaScript code

  • Body tag.
  • Head tag.
  • External JavaScript file.

The external sheet is connected in this way:

A script tag is added in the head of the HTML sheet, and the script tag holds the src attribute which refers to the path of the JavaScript file.

All the Javascript code will be going to the external file called “clicked.js”.

JAVASCRIPT VARIABLE

Variable provides a storage location for data with a particular name.

There are two types of variables

  1. Global variable.

A global variable is available and accessible to any location in the executable code.

2. Local variable.

A local variable is accessible only inside the function within which it is declared.

See the difference between both code snippets below to know the scope of bot variables.

JAVASCRIPT DATA TYPES:

JavaScript provides different data types to hold different types of values.

  1. Primitive data type: These data types are provided by the programming language as the basic building block.
source: https://www.istockphoto.com/photos/stone-age-tools

2. Non-primitive data type: These data types are derived from the primitive data types and combined together.

source: https://www.history.com/topics/inventions/firearms

The differences between primitive and non-primitive data types are:

primitive data types are immutable and stored by the value, whereas non-primitive data types are mutable and stored by reference.

Okay, let us meet in the next article on the operators and their types, JavaScript Type conversion. Thanks for your valuable time.

--

--