JavaScript Intro And Basic

JavaScript

JS is a part of web page that’s defines all the action perform on the web pages.

JS is a programming language with oop concepts.

JS is simple and easily compatible with HTML And CSS.

HISTORY

JS was founded by BRENDEN EICH

He developed JS in1995.

TOOLS

To work with JS we need two Tools:-

. Text-editor :- Where we write the JavaScript code.

. Browser :- Where our code is execute.

JavaScript First Code

Here we write the first code of JS where we print the ” HELLO WORLD”.

we print the word in console so to do this we have to open the console of the we page

to open the console just press ” ctrl + shift + i”.

After that console is open we have to write JS code in the console to print the word

CODE :-

console.log(“HELLO WORLD”);

console.log is use to print output.

Adding JS to HTML Page

We add JS in HTML through 2 way :-

  1. By adding script tag in the HTML page where the body tag is closing

    Ex –
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn">submit</button>
     
</body>
<script>

            console.log("HELLO WORLD");
    
</script>
</html>

2. By including the JS file or folder where we write the JS code.

Ex- By providing the source of the file or path .


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<script src="inc.js"></script>

<body>
    <button class="btn">submit</button>
     
</body>

</html>


THANKU 🙂

Related Posts

JAVA SCRIPT VARIABLE AND DATATYPE.

What is Variable ? Variable is just like a container which store the value into it . ex- var x=6; let y=x+z; In above example x and…

Read More

jQuery Basic

jQuery is a JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on the website. jQuery syntax is tailor made for…

Read More

PHP | Data Types

In PHP, Data types are used to declare one particular type of data as in all programming languages. Data Types define the type of data a variable…

Read More

Why PHP Is Still So Important for Web Development?

PHP (Hypertext Preprocessor) is a general-purpose scripting language that can be used to develop dynamic websites. It was from the first server-side languages that could be embedded…

Read More

What is Loops in JavaScript?

Looping in programming languages is a feature which facilitates the execution of a set of instructions/functions repeatedly while some condition evaluates to true. For example, suppose we…

Read More

What is JavaScript?

JavaScript is a scripting or programming language that allows you to implement complex features on web pages every time a web page does more than just sit…

Read More