DEV Community

Guru prasanna
Guru prasanna

Posted on

1

Javascript - Introduction

Javascript:

--> JavaScript is the world's most popular programming language.

--> JavaScript is the programming language of the Web.

--> JavaScript is easy to learn.

--> Dynamically typed programming language.

--> JavaScript (JS) is a cross-platform, object-oriented programming language used by developers to make web pages interactive.

Image description

Why should we Study JavaScript?

--> JavaScript is one of the 3 languages all web developers must learn:

  1. HTML to define the content of web pages (Structure)

  2. CSS to specify the layout of web pages (style)

  3. JavaScript to program the behavior of web pages (Functionality)

--> JavaScript is supported by almost all browsers.

Refer:https://www.w3schools.com/js/

Javascript is used in:

  • Web Development
  • Frontend and Backend Development
  • Game Development
  • Desktop Applications
  • Real-Time Applications
  • AI and Machine Learning

How to use javascript?

a) Internal javascript
b) External javascript

Internal and External JavaScript are the two ways of adding JavaScript code to an HTML document.

a) Internal JavaScript

Internal JavaScript refers to embedding JavaScript code directly within the HTML file using <script> tag, either inside the <head> or <body> tag. This method is useful for small scripts specific to a single page.

b) External javascript

External JavaScript is when the JavaScript code written in another file having an extension .js is linked to the HMTL with the src attribute of script tag.

Syntax:
<script src="url_of_js_file"> </script>

JavaScript Functions and Events:

--> Function is a block of JavaScript code, that can be executed when it is "called" for.

--> Function is a set of instructions or block of reusable code to perform specific task with a name.

--> Function is defined using function keyword.

For example, a function can be called when an event occurs, like when the user clicks a button.

Event: An event is an action or occurrence that happens in the browser.

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Javascript</title>
    <script>
        function payilagam(){
            document.getElementById("welcome").innerHTML = "Welcome to Payilagam";
        }
    </script>
</head>
<body>
    <h1 id="welcome"></h1>
    <button onclick="payilagam()">Click Me</button>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Output:

Image description

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay