Skip to main content

    JAVASCRIPT COURSE CONTENT


1. INTRO TO JAVASCRIPT

(1995-10 Days) Netscape team member

Java != JavaScript (LiveScript)

Initial Netscape, IE and now all the browsers

Anybody can learn

Basic HTML knowledge is a better option.

Text Editor, Browser (Console)

Case Sensitive; Camel Case


1.Difference between  Scripting & Programming Language 

(JS scripting or programming------.> Wikipedia

2.Difference between Client  End & Server End Programming/Scripting




2. WHY NEED TO BE MAINTAINED AT EXTERNAL FILE


We can avoid the messy look

Perform Better & Faster

Body Part (at least some content start to display on browser immediately)

Head Part (Analytical tariff will be easy part)


Head /Body/after Body/After Html end àwhich is best y?


<script> </script>

<noscript> </noscript>



3. PRINTING METHODS IN JAVASCRIPT


Console.log()

document.write()

alert (“ “)

prompt(“enter anything”) ----->its always a string

inner.HTML

How to print the output in the browser instead of console




4. COMMENT


Single line //

Multiline  /* */

Inline // 


5. VARIABLE (var)


Variable is a place helps to store the data temporary.

The first digit will be always alphabets It accepts both cases, numeric value and dollar symbol.

Difference between const and let



6. DATA TYPES


Number

String

Boolean

Undefined

Nan

Null

Array

Object


Difference between var a=0; and var a=null;

Primitive and Non Primitive Data Type 



typeof/ instanceof





7.OPERATORS


Arithmetic Operators (+, -, *, / ,** , %, ++, --)exponentiation

Assign Operators( x+=y;x=x+y)

Concatenation

Comparison Operators (==,!=,>,<,>) different data types (===,!==)

Logical Operator (AND &&, OR||, NOT!)

C= a+Number(b) (or) c = a+parseInt(b) (or) c= a+parseFloat(b)

C=a+ +b

Ternary Operator (T/F ? T: F)

Unary Operator

Bitwise Operator/zero fills





8. GENERAL TERMS


Operator

Expression

Statement

Block

Keyword

Identifier

Reserved Words




9. CONDITIONAL STATEMENT


if

else

else if

switch




10. NUMBER


Integer, Float-->Number 

STRING TO NUMBER CONVERSION

Number()

parseInt()

parseFloat()

+

toFixed()  -->it will be string

Math.round()

Math.sqrt()

Math.abs()

Math.ceil() -->4.4-->5

Math.floor()-->4.7-->4

Math.min

Math.max



0.1+0.2=0.300000004 but 1.1+1.2=2.3 why?


11.STRING


String can be declared with single or double quote

If u want to print quote inside the string then we need to choose declaration single or double quote depend upon the quote inside the string.

I’m ok --> “I’m ok”

he is “Mr.Perfect”   --> ‘he is “Mr.Perfect”’

Add -->Concatenation

Sub,mul,div asusal

Slice -->a.slice(2) (2,7) (-3.-1)

Replace -->a.replace( , )

a.replace(/ /g , )

a.replace(/ /i , )

a.replace(/ /ig, ) or a.replace(/ /ig, )

Split -->a.split(‘’)

a.split(‘,’)

a.split(‘ ‘) 




12. BOOLEAN


a = any number except zero is true

a= any string is true; just a quote without space is false

a=null;a=NaN;a=Undefined are false


13. ARRAY


Helps to store a list of value [allows mixed data type values too]

Index starts from Zero and length starts from the count 1

It consists only numbered index.

Array.length ; a.indexOf()

a[index]

a.push() a.pop()  -->Deals with last index

a.shift() a.unshift()  -->Deals with zeroth index

delete a[]  -->  delete and create empty slot

how can I delete a element of array without creating empty slot

how can I insert any element in the array at decided index


Concatenation --->a.concat(b,c)

Slice --->a.slice(2) (2,5) ---->second index to 4th index

Splice ---->a.splice(2,5) --->2nd index to next 5 index elements

Join

a.sort() --->Non Numeric Value;

a.sort(function(a,b){return a-b}) ---->Numeric value

a.reverse()



14. OBJECT


It’s a kind of array, stored and accessed with Named index;

Object.keyname or object[“key name”]

Comments

Popular posts from this blog

  You are provided with the radius of a circle "A". Find the length of its circumference. Note: In case the output is coming in decimal, roundoff to 2nd decimal place. In case the input is a negative number, print "Error". function   coc () { var   r = document . getElementById ( "num1" ). value ; var   pi = 3.1415 ; var   Circumference =( 2 * pi * r ); if  ( r >= 0 ) console . log ( Circumference ); else console . log ( "Error" )} 
The area of an equilateral triangle is ¼(√3a 2 ) where "a" represents a side of the triangle. You are provided with the side "a". Find the area of the equilateral triangle. function   sqrt () { var   a = document . getElementById ( "a" ). value ; b =  Math . sqrt ( 3 ); c =( 1 / 4 )* b * a * a ; console . log (  "Area =" + c )}

HOISTING

  HOISTING Variables” and “ function” declarations are moved to the top of their scope before code execution. Variables are hosted and not their values Only the normal function will be hoisted not the anonymous,IIFE and Arrow Function will be hoisted Properties are not hoisted PROPERTY  Any variable declared globally  become property of window variable declared without keyword variable declared with keyword var except function scope var console . log ( a )   // Error a not defined console . log ( a );  // undefined --> var a is hoisted not value var   a  =  20 ; console . log ( a , b )  // Error --->property b can't hoist var   a  =  20 ; b  =  40 ; var   a  = add ( 2 , 5 )  // Error console . log ( a ) var   a  = add ( 2 , 5 )  // 7 function add hoist console . ...