JavaScript

avatar

NaN years ago

JavaScript is the world most popular lightweight, interpreted compiled programming language. It is also known as a scripting language for web pages. It is well-known for the development of web pages, many non-browser environments also use it. JavaScript can be used for Client-side developments as well as Server-side developments.


JavaScript can be added to your HTML file in two ways:


  • Internal JS: We can add JavaScript directly to our HTML file by writing the code inside the <script> tag. The <script> tag can either be placed inside the <head> or the <body> tag according to the requirement.


  • External JS: We can write JavaScript code in another file having an extension .js and then link this file inside the <head> tag of the HTML file in which we want to add this code.


Syntax:

<script>
    // JavaScript Code
</script>


Example: It is the basic example of JavaScript code embedded in HTML code.

<!DOCTYPE html>
<html lang="en">
 
<head>
    <title>
        Basic Example to Describe JavaScript
    </title>
</head>
 
<body>
 
    <!-- JavaScript code can be embedded inside
        head section or boy section -->
    <script>
        console.log("Welcome to world");
    </script>
</body>


 Output: The output will display on the console.

Welcome to GeeksforGeeks


What can we build using JavaScript?


JavaScript is a widely-used programming language. Given below are some domains/products that can be built using JavaScript:


  • Websites: JavaScript helps us to add the behaviour of our website. It helps users to interact with the website. For eg. clicking on buttons, saving details, uploading details on the website, etc.


  • Web Servers: We can make robust server applications using JavaScript. To be precise we use JavaScript frameworks like Node.js and Express.js to build these servers.


  • Game Development: In-Game Development industry, JavaScript is used widely. With the addition of HTML5 Canvas, it’s now possible to make 2D and 3D games in JavaScript very efficiently.


  • 3D Drawings: JavaScript in addition to HTML Canvas is used to make three-dimensional graphics.


  • Mobile Apps: Mobile applications are the most popular modes of communicating these days. JavaScript is also used to design mobile applications. There are many JavaScript frameworks using which we can make android, IOS, and hybrid apps.


  • Smartwatch Apps: The popular smartwatch maker Pebble has created Pebble.js, a small JavaScript framework that allows a developer to create an application for the Pebble line of watches in JavaScript.


Why learn JavaScript?


JavaScript is the most popular and hence the most loved language around the globe. Apart from this, there are abundant reasons to learn it. Below are a listing of few important points:


  • No need for compilers: Since JavaScript is an interpreted language, therefore it does not need any compiler for compilations.


  • Used both Client and Server-side: Earlier JavaScript was used to build client-side applications only, but with the evolution of its frameworks namely Node.js and Express.js, it is now widely used for building server-side applications too.


  • Helps to build a complete solution: As we saw, JavaScript is widely used in both client and server-side applications, therefore it helps us to build an end-to-end solution to a given problem.


  • Used everywhere: JavaScript is so loved because it can be used anywhere. It can be used to develop websites, games or mobile apps, etc.


  • Huge community support: JavaScript has a huge community of users and mentors who love this language and take its legacy forward.



approvedApproved by experts
Advance Topics

Neuton's Mission

We are a team of young and enthusiastic people who are passionate about education and want to help students to learn the skills they need to succeed in life. If you want to support us, please join our community.

phonephonephonephonemail