Write a script for the following problems 1 Use the Date cla

Write a script for the following problems.

1. Use the Date class to find the day of your next birthday.

2. Use one of the Math methods to come up with the answer of 200

3. Find the length of the following string: \"University of State\"

4. Create an array from your name and then print each letter of your name.

*Use JavaScript for all

Solution


var String=\"University of State\";
var d=new Date(\"Aug, 31,2016\");
var daye=new Array(\"Sunday\",\"Monday\",\"Tuesday\",\"Wensday\",\"Thursday\",\"Friday\",\"Saturday\");
var StringLen=String.length;
if(StringLen>0)
{
window.alert(\"The Length Of \' \"+String+\" \' Is:\"+StringLen);
}
var date=d.getDate();
var month=d.getMonth();
var month=month+1;
var year=d.getUTCFullYear();
var day=d.getDay();
if((date>0)&&(month>0)&&(year>0)&&(day>0))
{
window.alert(\"The Present Day Of You BirthDay Is:\"+date+\"-\"+month+\"-\"+year+\"=>:\"+daye[day]);
}
var year1=year+1;
var d1=new Date(year1, month-1, date);
var day1=d1.getDay();
if(day1)
{
window.alert(\"The Next Day Of You BirthDay Is:\"+daye[day1]);
}
var num=199.8;
if(num>1)
{
window.alert(\"The Round Of \"+num+\" Using Math.round Function Is:\"+Math.round(num));
}
var na = [\"k\", \"u\", \"m\", \"a\", \"r\"];
var i;
window.alert(\"The Name Is: kumar\");
for (i = 0; i < na.length; i++) {
window.alert(\"The \"+(i+1)+\" Letter In You Name Is:\"+na[i]);
}

window.alert(\"Thanks Chegg Team For Giving This Opportunity\");

Write a script for the following problems. 1. Use the Date class to find the day of your next birthday. 2. Use one of the Math methods to come up with the answe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site