0% found this document useful (0 votes)
1 views

Javascript_Notes-3

Javascript is a programming language used for web development, allowing for dynamic changes to HTML and CSS, and was created by Brendan Eich in 1995. It includes various features such as variables, arrays, functions, and conditional statements, which facilitate programming behaviors and data manipulation on web pages. Understanding Javascript is essential for defining web page content, layout, and interactivity.

Uploaded by

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

Javascript_Notes-3

Javascript is a programming language used for web development, allowing for dynamic changes to HTML and CSS, and was created by Brendan Eich in 1995. It includes various features such as variables, arrays, functions, and conditional statements, which facilitate programming behaviors and data manipulation on web pages. Understanding Javascript is essential for defining web page content, layout, and interactivity.

Uploaded by

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

1)What is javascript:-->

a)Javascript is programming language for web


b)it can update and change both html and css
c)it can calculate, manipulate and update data

d)javascript and java are completely different programming languages both in


concepts and design
e)Javascript was invented by brendan eich in 1995
f)ECMAscript is the official name for javascript
g)ES6 is current version of javascript

2)Why to learn javascript:-->


a)Html:-->to define content of web page
b)CSS:-->to define layout and design of web page
c)Javascript:-->to program the behavior of web page

3)Javascript can change HTML contents:-->

4)type's js:-->
a)inline js:-->define js effect for single html element
b)internal js:-->can be used by current web page
<script type="text/javascript">
code goes here
</script>

c)external js:-->can be used by entire application


<script type="text/javascript" src="location of js/js file"></script>

5)javascript can change html attribute value:-->

6)Javascript can hide html element:-->

7)Javascript can change text size:

8)javascript output:-->
a)innerHTML:-->
b)innerText:-->
c)document.write():-->
d)window.alert():-->
e)console.log():-->
f)window.print():-->

9)Javascript variables:-->variables are used to store data values


a)How to declare variables in javascript
I)var :--> was used from 1995 to 2015(for older browsers)
II)const:-->can be used for array and object if value changed
III)let:-->can be used in any case

10)Javascript Arrays:-->Can hold multiple values in singal variable


a)We can create array using keyword new
b)accessing array values
c)changing index values
d)how convert array to string = toString();

11)Array Properties And Methods:-->


a)length:-->return with length of array
b)Accesing First element/value of array
c)Accessing Last element/value of array
12)Looping of array:-->
a)for loop:-->
b)adding array element

13)Differenece between array and object


a)In javascript array uses numbered index
b)In javascript object uses named index

14)When to use array or object


a)Javascript does not support associative array
array("Name"=>"Madhav","City"=>"Bangalore","Email"=>"[email protected]");
["Name"=>"Madhav","City"=>"Bangalore","Email"=>"[email protected]"]

b)If need to give indexing as string/name/text we have to use object

c)If need to give indexing as number we have use array

15)How to recognize an Array:


a)typeof:-->typeof always returns as object
b)Array.isArray();

17)Javascript Data Types:-->


a)string:-->a string(text string) is a series of charcters
b)number:-->normal number(1,2,10) or decimal number(1.2,05,12.12)
c)bigint:-->bigint is new data type introduced(ECMA2020) store big integer values
d)undefined:-->a variable without a value know as undefined
e)null : variable with null value
f)boolean: boolean have two values true or false
g)object:-->object can be stored inside {} built-in object or user defined object
Built-in:-->arrays,dates,maps etc

18)Javascript functions:-->javascript function is a block of code designed to


perform particular task
function is defined by function keyword followed by function name and
function functionname(){
code
}

return statement:-->when function reaches return statement function will stop

a)Why to use:
I)with function we can reuse the
II)we can write code that can be used many times
III)We can use same code for diffrent arguments and get different result

19)Javascript objects:-->objects are variable too. but can contains many values
{name:'Arun',age:'23'}
Object comes in name and value pair also called key and value
a)Using object literal:-->an object literal is a list name and value pairs inside
{}
I)How to access value for key from object
objectName.keyname

20)Javascript Date object:-->date objects are static


a)javascript date object output:-->by default javascript uses the browser's time
zone and display date as full text string
b)How to create date object:-->date objects are created by the new Date()
constructor
I)new Date()
II)new Date('date string')

21)Javascript Conditions:-->Conditional statements are use to perform different


actions based on different conditions
a)if condition:-->specify a block of code to be executed if given condition is true
b)else condition :-->block of code will execute if the first is false
c)else if condition:-->to check that first condition is false
d)switch:-->switch specifies many alternative block of codes to be executed

22)Javascript loops:-->loops can execute block of code number of time


a)for loop:-->in for loop we need to pass 3 expressions
for(expression1,expression2,expression3){

}
I)Expression 1:-->it is executed one time before executing for loop code
II)Expression 2 :-->defines the condition for executing for loop block code
III)Expression 3:-->this will execute every time after last loop execution till end
of for loop

You might also like