// for comment from keyboard (ctrl+ /)
// document.writeln("hi from javascript external");
var name1=5;
var Name="ahmed";
var $name=45;
var sum = $name+name1;
// document.writeln(sum);
function myclick() {
alert("new alert");
}
// === this qual for type and value
// == this qual for value only
if (1=="1" & 2 === "2" ) {
document.write("equal 1");
} else if (1==="1" | 2 === "2") {
document.write("equal 2");
}else if (1===1)
{
document.write("equal 3");
}
else
{
document.write("not equal");
}
var today="sunday";
var result;
switch (today) {
case "sunday":
result="sunday"
break;
case "monday" :
result ="monday"
default:
break;
}
document.write(result);
for (let i = 0; i<10 ; i++) {
document.write( i+" - "+"ahmed jamal
");
}
var x= 10
while (x<=20) {
document.write( x +"
");
x++;
}
do {
document.write( x +"
");
x++;
} while (x<=20);
function age(num1) {
alert("my age is " + num1);
}
person={
names:"ahmed",
age:20,
lastname:"midoo"
}
document.write(person.names + " " + "age = "+ person.age);
document.write("
");
function myemployee(id,name,lname,age) {
this.id=id;
this.name=name;
this.lname=lname;
this.age=age;
}
emp=new myemployee(1,"ahmed","jamal",26);
document.write(emp.name+ " "+emp.lname + " "+emp.age);
document.write("
");
document.write("
");
var myname = ["ahmed","essa","hamed"];
for (let index = 0; index < myname.length; index++) {
const element = myname[index];
document.write(element + "
");
}
document.write("
");
document.write("
");
var num11=22;
var num22=2.4112244;
var num33=25e3;
//var num44= new number(14);
num55=num22.toFixed(2);
num77=num22.toPrecision(3);
num88=num22.toExponential(1);
num66=num11.toString();
document.write( num11);
document.write( num22+"
");
document.write( num33+"
");
document.write( num55+"
");
document.write( num66+"
");
document.write( num77+"
");
document.write( num88+"
");
document.write( typeof(num88)+"
");
//document.write( num44+"
");
document.write("
");
document.write("
");
var myname =" ahmed jamal jamal";
var lname = new String ("jamal");
document.write(myname.charAt(3) + "
");
document.write(lname.charAt(2) + "
");
document.write(myname.concat(lname) + "
");
document.write(lname.indexOf("al") + "
");
document.write(lname.lastIndexOf("ja") + "
");
document.write(lname.toUpperCase() + "
");
document.write(lname.toLowerCase() + "
");
document.write(lname.slice(1,3) + "
");
document.write(myname.trim() + "
");
document.write("
");
document.write("
");
var num122 = 4;
var num52= Math.sqrt(num122);
var numMath = Math.random(4);
var numPow = Math.pow(2,4);
var numFloor = Math.floor(2.7);
var numCeil = Math.ceil(2.9);
document.write(num22 + "
");
document.write(numMath + "
");
document.write(numPow + "
");
document.write(numFloor + "
");
document.write(numCeil + "
");
document.write("
");
document.write("
");
document.write(1<2);
document.write("
");
document.write(22<1);
document.write("
");
document.write("
");
var mydate = new Date();
var myDay= mydate.getDate();
var myMonth= mydate.getMonth();
var myYear= mydate.getFullYear();
var myHours = mydate.getHours();
document.write(mydate + "
");
document.write(myMonth+1 + "
");
document.write(myYear + "
");
document.write(myHours + "
");
document.write("
");
document.write("
");
function fname() {
// window.history.back();
// window.history.forward();
document.write("
" + " appCodeName - "+ window.navigator.appCodeName);
document.write("
" + " appName - "+ window.navigator.appName);
document.write("
" + " cookieEnabled - "+ window.navigator.cookieEnabled);
document.write("
" + " language - "+ window.navigator.language);
document.write("
" + " platform - "+ window.navigator.platform);
document.write("
" + " platform - "+ window.navigator.platform);
}
fname();
document.write("
");
document.write("
");
function fscreen() {
document.write("
" + " width - "+ window.screen.width);
document.write("
" + " height - "+ window.screen.height);
document.write("
" + " colorDepth - "+ window.screen.colorDepth);
document.write("
" + " pixelDepth - "+ window.screen.pixelDepth);
document.write("
" + " availHeight - "+ window.screen.availHeight);
document.write("
" + " availWidth - "+ window.screen.availWidth);
}
fscreen();
document.write("
");
document.write("
");
document.getElementById("addelm").innerHTML("ahmed jamal");
function name12() {
document.getElementById("inpelme").value = "ahmed jamal";
}
document.write("
");
document.write("
");
var nname = document.getElementByTagName("INPUT")[0].value;
document.getElementById("addelmm").innerHTML=nname;
document.write("
");
document.write("
");
function CreateForm() {
var myform = ' '
document.getElementById("created").innerHTML=myform;
}