[go: up one dir, main page]

0% found this document useful (0 votes)
2 views2 pages

JAVA SCRIPT

The document explains the roles of HTML, CSS, and JavaScript, highlighting that JavaScript is a full-fledged programming language used for adding functionality to HTML. It outlines the five basic JavaScript primitive data types: Number, String, Boolean, Variables, and Null/Undefined, along with their characteristics and usage. Additionally, it describes three methods of JavaScript (alert, console.log, and prompt) and how to link an external JavaScript file to HTML.

Uploaded by

sunnyaugustin134
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

JAVA SCRIPT

The document explains the roles of HTML, CSS, and JavaScript, highlighting that JavaScript is a full-fledged programming language used for adding functionality to HTML. It outlines the five basic JavaScript primitive data types: Number, String, Boolean, Variables, and Null/Undefined, along with their characteristics and usage. Additionally, it describes three methods of JavaScript (alert, console.log, and prompt) and how to link an external JavaScript file to HTML.

Uploaded by

sunnyaugustin134
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

JAVA SCRIPT

HTML is for Nouns Like Anushka, input fields, buttons, forms etc
CSS is for Adjectives Like Styling with colors, borders, background images etc
Java Script is for Verbs/Actions Like Dance,Eat
Java Script is Full pledged Programming Language. The main purpose of java script is to add
functionality (actions) to the HTML.
Usually we can Java Script in the Front-end and we can use Node JS for Back-end.

The 5 Basic JavaScript Primitive Data Types


NUMBER
All these are of "number" type
 Java Script never cares whether it is integral or float-point or signed and unsigned.
 General Mathematical operators are applicable for numbers
We can check the type of variable by using typeof keyword
typeof x;
STRINGS
Any sequence of characters within either single quotes or double quotes is treated as string. 
'durga' --- "durga"
If both arguments are number type then + operator acts as arithmetic addition operator.
If atleast one argument is of string type then + operator acts as concatenation operator.
We can find by using length variable Eg:'durgasoft'.length
By using index index of first character is zero 'durga'[2]  r 'durga'[200]  undefined but no
error 'durga'[-1]  undefined
BOOLEAN
The only allowed values are: true and false (case sensitive)
VARIABLES
Variables are containers to store values.
Syntax: var variableName=variableValue Eg: var name = "durga
Note: JavaScript variables follow CamelCase Convention
studentMobileNumber -- Camel case(Java,JavaScript etc)
student_mobile_number --Snake Case(Python )
student-mobile-number -- Kebab Case(Lisp)
Hence Java Script is dynamically Typed Programming Language like Python
NULL AND UNDEFINED
Variables that are declared but not initialized, are considered as undefined
Eg: var x; typeof x – undefine

3 methods of java script


Alert()
To display alerts to the end user

alert('Hello there')

Console.log()
To print messages to the developer's console

Eg: console.log('Hello there')

Prompt()
 To get input from the end user prompt('What is Your Name:')

 Here we are not saving the value for the future purpose. But we can save as follows var name=
prompt('What is Your Name:')

How to write JavaScript to a seperate File and connect to HTML


<Script type=”text/javascript” src=”demo.js”> </script>

You might also like