/    Sign up×
Community /Pin to ProfileBookmark

Method Using Prompt And Math.pwr

In this assignment I have to create the website to use math.pwr and use an prompt to ask the user “to what power would you like to raise your number? I am attaching my code….it is not working at all, no prompt no nothing.

PLEASE HELP

<html>
<head>
<title>skillmethod.html</title>
</head>
<body>
<script language=”JavaScript”>
myNumber=prompt(“Type a number:”,””);

// **** insert code here ****

var=myNumber;
var=”power”;
var=”result”=Math.pow(myNumber, power);

//create myNumber
result=prompt(“To what power would you like to raise the number?”,””);

document.write(myNumber+” multiplied “+power+” equals “+result);

</script>
</body>
</html>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyFeb 01.2006 — It's an assignment.. It's your assignment!! If you can't do it, you fail. You should be paying attention in class..

But, ill give you a little help.

You have things in the wrong order. IE, you ask for the number, then you complete the math, and then ask for the power number... How can the javascript complete the math without the power number in the first place? Plus, you have extra = in there you dont need, setting a variable is done like so:

var result = Math.pow(myNumber, power);

And one last thing,

var myNumber = prompt("Type a number:");

Have another go and get back if you still have problems
×

Success!

Help @lacosentino spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...