Skip to main content
added 640 characters in body
Source Link
Inkbug
  • 554
  • 4
  • 15

JavaScript (ECMAScript), 1710 chars

5**.5/2+.5 

This is the same as the Perl & Python submission - thanks to Redwolf Programs for telling me about this.

However, back in 2012, when this answer was originally written, the ** operator did not exist in JavaScript. While almost all browsers and do now support the exponentiation operator, according to Can I Use, as of July 2020, around 9% of users still does not support it, including the latest version of Internet Explorer. Thus, the old version of the answer:

JavaScript (backwards-compatible), 17 chars

Math.sqrt(5)/2+.5 

JavaScript, 17 chars

Math.sqrt(5)/2+.5 

JavaScript (ECMAScript), 10 chars

5**.5/2+.5 

This is the same as the Perl & Python submission - thanks to Redwolf Programs for telling me about this.

However, back in 2012, when this answer was originally written, the ** operator did not exist in JavaScript. While almost all browsers and do now support the exponentiation operator, according to Can I Use, as of July 2020, around 9% of users still does not support it, including the latest version of Internet Explorer. Thus, the old version of the answer:

JavaScript (backwards-compatible), 17 chars

Math.sqrt(5)/2+.5 
Source Link
Inkbug
  • 554
  • 4
  • 15

JavaScript, 17 chars

Math.sqrt(5)/2+.5