Question
I tried these 2 questions but have not got the results. So please help me.
Create a string variable called favoriteMovie and provide a value. Create a number variable called movieLength and input the length of the movie in minutes. Create a JavaScript "if/else" statement that determines the following: If the movie is more than 100 minutes long, use the JavaScript document.write() function to write out the sentence "My favorite movie is {favoriteMovie} and the time flies by" Use the appropriate JavaScript variables in your output, and ensure that your movie's name is in quotes. If the movie is less than or equal to 100 minutes long, use the JavaScript document.write() function to write out the sentence "My favorite movie is {favoriteMovie}. but I wish it were longer." Use the appropriate JavaScript variables in your output, and ensure that your movie's name is in quotes. You will create a link to a web page using JavaScript. Pick any (family friendly) website you can think of and then ... Create a string variable called linkTitle and provide a value (this is the display name of the link.) Create a string variable called linkURL and provide the URL for the website. Use the JavaScript document.write() function to write out the sentence "I found a website titled {linkTitle} and you should really check it out" You must add in an HTML anchor ("") tag so that the linkTitle links to the value of the linkURL variable.
Explanation / Answer
1)
string favoriteMovie="Terminator";
int movieLength=90;
function movie(movielength,favoriteMovie)
{
if(movielength>100)
document.write("My favorite movie is"+favoriteMovie+"and the time flies by.");
if(movielength<=100)
document.write("My favorite movie is"+favoriteMovie+",but I wish it were longer.");
return true;
}
2
string linktitle="google";
string linkURL="www.googgle.com";
function linktowebsite(linktitle,linkURL)
{
document.write("<a href="+ linkURL +">I found a website titled " + linktitle + " and u should really check it out</a>");
return true;
}