Java -Protractor

 Node: Node is used to install 3rd party jars.

Primitive Types:

strings, numbers,null,undefined,objects


primitives are copied by their values.

let a=10;

let b =a;

a=30;

console.log(a);//30

console.log(b);10

reference types:

Objects

Arrays

Functions

Objects  are copied by their values.

let a={value:10}

let b =a;

a=30;

console.log(a);//30

console.log(b);30

the default values of variable in jsavascipt is undefined 


Object :


let persons = {
nameE : 'Kumar',
ageof : 1234
}
console.log(persons.ageof);
console.log(persons.nameE);
console.log(persons);

Cloning an Object :

Const circle = {
aaa : 123,
bbb: 234,
ccc : 'sudheer'

}
const circle1 = {...circle};
const circle3 = Object.assign({color: 'yellow'},circle1);

//console.log(circle);
circle.ccc =345;
//console.log(circle);


//delete circle.ccc;
///console.log(circle);


for(value in circle1){
console.log(circle1);
}


Arrays:


let arrayCities = ['London',1234,'Overland Park','chicago','nashua'];
arrayCities[5]= 'st Lousis'
console.log(arrayCities)
console.log(arrayCities.length);

for (let index = 0; index < arrayCities.length; index++) {
const element = arrayCities[index];
console.log(element);
}


functions:


function greeting(name){
console.log('Hello !!' + name);
}
greeting('Cool Kewl');





for(let i =1 ; i<=5;i++){
//console.log('printing',i);
if(i%2 !==0){
console.log(i);
}
}


let j =1;
while(j<20){
//console.log(j);
if(j%2 !==0){
console.log('its an ODD number', j);
}
j++;
}



function maxnumbers(a,b){
if(a>b){
console.log(a);
}else
console.log(b);
}

//let numbersa = maxnumbers(14,55);


function evenORodd( a ){
if(a%2===0 ){
console.log("it is even",a)
}else
console.log('it is odd', a)
}


evenORodd(12);



// let statea ;
// let citya;
// let ziocode;
//constructor function--starts with cap letter
function Address(street,city,zipcode){
this.statea = street;
this.citya = city;
this.ziocode= zipcode;

}

//factory function--camel case
function createAddress(street,city,zipcode){
return{
streetaa:street,
cityaa:city,
zipcodeaa:zipcode
}
}

let address = new Address('12','erer',3434);

let addressq = new createAddress('233','3434','fgfg');

console.log(addressq);
console.log(address);

Comments

Popular posts from this blog

Implicit and Explicit Waits,FluentWait,PageLoadTimeOut

A Interview Questions- selenium