├── conditional.js
├── hover.js
├── hovereffect.html
├── strictl.js
└── variables.js
/conditional.js:
--------------------------------------------------------------------------------
1 | // conditional Operator: ( ? : )
2 |
3 | const age=11;
4 | const res=(age>=18)?"Eligible for vote":"Not eligible for vote";
5 | console.log(res);
6 |
7 | // Using Object based
8 |
9 |
10 | var user={'fname':"Murali",'age':20};
11 | user.fname="Rio";
12 | console.log(user.fname);
13 | const welcome=(user)=>{
14 | const r=user.fname?user.fname:"Stranger";
15 | return "Hello "+r;
16 | }
17 | console.log(welcome(user));
18 |
19 | //chained conditional Operator:
20 |
21 | const a=80;
22 | const b=a>=90?"A grade":a>=80?"B grade":a>=70?"C Grade":"Fail";
23 | console.log(b);
--------------------------------------------------------------------------------
/hover.js:
--------------------------------------------------------------------------------
1 | var textbutton=document.querySelector(".btn");
2 | textbutton.addEventListener("mouseover",firstFunction);
3 | textbutton.addEventListener("click",secondFuction);
4 | textbutton.addEventListener("mouseout",thirdFunction);
5 |
6 | function firstFunction(){
7 | document.querySelector("#content").innerHTML+="Mouse in
"
8 | }
9 |
10 | function secondFuction(){
11 | document.querySelector("#content").innerHTML+="clicked
"
12 | }
13 |
14 | function thirdFunction(){
15 | document.querySelector("#content").innerHTML+="Mouse out
"
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/hovereffect.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |