27 Jun 2019

java script Tutorial

<!DOCTYPE html>
<html>
<head>

</head>

<body>
<h1>Introduction Of Java script Function</h1>

<p>
<span id="demo"></span><br>

<span id="demo1"></span><br>
<span id="demo2"></span><br>
<span id="demo3"></span><br>
<span id="demo4"></span><br>
<span id="demo5"></span><br>
<span id="demo6"></span><br>
<span id="demo7"></span><br>
<span id="demo8"></span><br>
<span id="demo9"></span><br>
<span id="demo10"></span><br>
<span id="demo11"></span>
</p>

<script>
var devesh = 'My name is does \'t Devesh Agrawal';

var x= "Hello";
var y= "Hello";

document.getElementById("demo1").innerHTML="My Name is :"+devesh;

document.getElementById("demo").innerHTML="My Name Length is :"+devesh.length;

document.getElementById("demo2").innerHTML="Type of devesh :"+ typeof devesh;

document.getElementById("demo3").innerHTML="Type of devesh :"+ (x===y);
</script>

</body>
</html>


<script>
<!-- var Car ={ -->
  <!-- Make:"BMW", -->
  <!-- Number:"5553" -->
<!-- }; -->
 
var newKeyword = new Object();
newKeyword.mm="Audi";
newKeyword.pp="5543i";
function constructor(make,number)
{
this.makename=make;
this.makenumber=number;
}
var car1 = new constructor("BMW","5566i");
var car2 = new constructor("BMW","5566i");
document.getElementById("demo").innerHTML="The Car Name Is: "+newKeyword.mm +"<br>"+ "The Number is :"+newKeyword.pp;

document.getElementById("demo1").innerHTML="The Car Name Is: "+ car1.makename+"<br>"+ "The Number is :"+car2.makenumber;
</script>


<script>
<!-- var Car ={ -->
  <!-- Make:"BMW", -->
  <!-- Number:"5553" -->
<!-- }; -->

var newKeyword = new Object();
newKeyword.mm="Audi";
newKeyword.pp="5543i";

function constructor(make,number)
{
this.makename=make;
this.makenumber=number;
}
var car1 = new constructor("BMW","5566i");
var car2 = new constructor("BMW","5566i");
document.getElementById("demo").innerHTML="The Car Name Is: "+newKeyword.mm +"<br>"+ "The Number is :"+newKeyword.pp;

document.getElementById("demo1").innerHTML="The Car Name Is: "+ car1.makename+"<br>"+ "The Number is :"+car2.makenumber;
</script>




<script>
var devesh = ["Manish","Dev","Varsha","Nidhi","Pooja"]



document.getElementById("demo1").innerHTML="There name is :"+ devesh.sort();

document.getElementById("demo").innerHTML="My Name Length is :"+devesh.length;

document.getElementById("demo2").innerHTML="Type of devesh :"+ typeof devesh;

document.getElementById("demo3").innerHTML="Type of devesh :"+ devesh[4];

document.getElementById("demo4").innerHTML="Type of devesh :"+ devesh.join(" and ");

document.getElementById("demo7").innerHTML="Type of value of  :"+ devesh;
devesh[0]="Dev";

var arg = [2,1,10]

arg.sort(function(a,b)
{
return (a-b);
});
document.getElementById("demo11").innerHTML="Type of value of  :"+ arg;

function Deletedata()
{
delete devesh[2];
document.getElementById("demo5").innerHTML="Type of devesh :"+ devesh;
}

function popdata()
{
devesh.pop();
document.getElementById("demo6").innerHTML="pop data of devesh :"+ devesh;
}

function pushdata()
{
devesh.push("Timmu");
document.getElementById("demo8").innerHTML="push data of devesh :"+ devesh;
}

function shiftdata()
{
devesh.shift();
document.getElementById("demo9").innerHTML="shift data of devesh :"+ devesh;
}

function unshiftdata()
{
devesh.unshift("Anshika");
document.getElementById("demo10").innerHTML="unshift data of devesh :"+ devesh;
}


</script>



<script>

var ages=[10,20,25,35,40,45,50];


function Fn(age)
{
return age>=18 && 40>=age;
}

document.getElementById("demo").innerHTML=ages.filter(Fn);
</script>


<script>
var arg=["ramesh","Poonam","Varsha","Nidhi","Divya"]

arg.forEach(Fn);

function Fn(Index,Value)
{
document.getElementById("demo").innerHTML += Index +":"+Value+"<br>";
}

</script>

No comments:
Write comments

Contact Form

Name

Email *

Message *

© 2014 Rock Programmer . Designed by Bloggertheme9
Powered by Rock Programmer.