This is the era of technology. Mankind is trying to build a civilization on another planet, smart cars, humanoid robots, and so on. We are living in a digital world and due to this, it becomes important for kids to learn to code, the core of the technology.
- A script or program can be considered a set of statements. That a programmer asks a computer to follow.
- In JS, the statement starts from a new line & ends with a semicolon(;).
Do not try to memorize all of them, they are just for your future reference and to build a foundation of understanding for you.
- Variables: They hold a single word, number, or any other information in code and include variable type, name, and value.
- If and Else statement: ‘If’ runs a part of code if the condition is satisfied and ‘Else’ runs a part of code if the condition is not satisfied.
- Functions: A group or block of code which can be used to perform a particular task more than once in the same program/Script.
- Loops: Loop will check if the given condition is true or satisfied if yes then it will run the part of code continuously till the condition is false.
- Arrays: They are containers that hold a similar type of variable.
Also, you can choose your favorite text editors such as Visual Studio Code, Atom, Notepad++, Sublime Text, or any other to write code. So simply, you need a text editor to write your program and a browser to display your program.
Initially it was developed for web pages and now you can see JS in all the major areas and some of them are:
- Web Page design: The most common use of JS is in Web development. It is used to make web pages interactive, beautiful, and accessible for the user. For example, animation display, playing audio or video on the web page, Image zoom in and out, etc.
Fact: With React Native framework of JS, you can develop apps for iOS and Android operating systems with a single program. You just need to write it once and it will run on different platforms.
- Easy to code and run: All you need is a text editor to write code and a browser to run it. So you can easily experiment with your creativity.
- Extensive future growth: JS is one of the highest-paying technologies in the current world. There is a huge demand in the market for web developers. So you can build a secure career in front-end web development after learning JS with HTML and CSS. Many other high-demand career opportunities are available with JS such as full-stack Web developer & App developer, and game developer, and many more.
- Cross-platform application development: Although JS was designed for the web initially, now it’s everywhere. So with one language, you can work in many fields including ML, Game Development, App development, etc.
Let’s write a simple ‘Hello World’ program in JS. There are three ways we can do that and they are:
- log(): Used in code debugging.
- alert(): Displays an alert box on the webpage.
- write(): Prints the content to the HTML document.
We will try the alert() method of printing hello world. So Follow the following steps on your system:
- Open your favorite code Editor.
- Create a new file and start writing code.
Note: We add the ‘script’ tag in the body or in the head tag of HTML code. In this script tag, our JS code is written.
- Save your file with any name followed by a .html extension. i.e. helloworld.html
- Open the helloworld.html. This will display an alert box written ‘Hello world!’.
The world is continuously changing. Coding helps your child with their creativity and enables them to develop competitive skills for the future. So let your child learn new technologies through online coding classes.