459,610 Members | 1,923 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,610 IT Pros & Developers. It's quick & easy.

basic question

 P: n/a Hi In Visual Basic I have this numeric expression : x = 2 ^ i; if i = 3 the result for x would be 2 * 2 * 2 = 6; is there any equivalent in javascript for the "^" arithmetic operator ? thanks in advance Jul 20 '05 #1
6 Replies

 P: n/a In article , no****@hotmail.com enlightened us with... Hi In Visual Basic I have this numeric expression : x = 2 ^ i; if i = 3 the result for x would be 2 * 2 * 2 = 6; is there any equivalent in javascript for the "^" arithmetic operator ? Math.pow(x, n) Returns x to the power of n var i = 3; var y = Math.pow(2, i); y will be 6. ------------------------------------------------- ~kaeli~ Hey, if you got it flaunt it! If you don't, stare at someone who does. Just don't lick the TV screen, it leaves streaks. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace ------------------------------------------------- Jul 20 '05 #2

 P: n/a "kaeli" wrote: var i = 3; var y = Math.pow(2, i); y will be 6. You mean 8. Jul 20 '05 #3

 P: n/a In article , vj*******@inet.hr enlightened us with... "kaeli" wrote: var i = 3; var y = Math.pow(2, i); y will be 6. You mean 8. I'm sleeping today. :) ------------------------------------------------- ~kaeli~ Hey, if you got it flaunt it! If you don't, stare at someone who does. Just don't lick the TV screen, it leaves streaks. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace ------------------------------------------------- Jul 20 '05 #4

 P: n/a In article , no****@hotmail.com says... Hi In Visual Basic I have this numeric expression : x = 2 ^ i; if i = 3 the result for x would be 2 * 2 * 2 = 6; Another reason not to use Visual Basic, then. -- Hywel I do not eat quiche http://hyweljenkins.co.uk/ http://hyweljenkins.co.uk/mfaq.php Jul 20 '05 #5

 P: n/a Altar wrote on 17 sep 2003 in comp.lang.javascript: Hi In Visual Basic I have this numeric expression : x = 2 ^ i; if i = 3 the result for x would be 2 * 2 * 2 = 6; is there any equivalent in javascript for the "^" arithmetic operator ? thanks in advance pow Method This method returns the value of x to the power of y, where x is the base, and y is the exponent. result = Math.pow(x, y) -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress) Jul 20 '05 #6

 P: n/a JRS: In article , seen in news:comp.lang.javascript, kaeli posted at Wed, 17 Sep 2003 09:24:36 :-Math.pow(x, n) Returns x to the power of nvar i = 3;var y = Math.pow(2, i);y will be 6. 8 -- © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. © TP/BP/Delphi/&c., FAQqy topics & links; RAH Prins : c.l.p.b mFAQ; Timo Salmi's Turbo Pascal FAQ. Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.