Skip to content

Instantly share code, notes, and snippets.

Forked from 140bytes/LICENSE.txt
Last active Oct 2, 2015
What would you like to do?

A function to get rid of the stupid "Math" object once and for all!

It allows this sort of syntax:

 myVariable = floor(myVariable)
 myOtherVariable = random()
a, b //placeholders
for(b in a = Object.getOwnPropertyNames(Math)) //for every item in the "Math" object
this[a[b]] = Math[a[b]] //set the global item to the math item
function(a,b){for(b in a=Object.getOwnPropertyNames(Math))this[a[b]]=Math[a[b]]}
"name": "MathGlobalizr",
"description": "A function to get rid of the stupid Math object once and for all!",
"keywords": [
<!doctype html>
<div>Expected value: <b>25</b></div>
<div>Actual value: <b id=ret></b></div>
function(a,b){for(b in a=Object.getOwnPropertyNames(Math))this[a[b]]=Math[a[b]]}
document.getElementById("ret").innerHTML = floor(25.64)
Copy link

atk commented Mar 28, 2012

Please correct package.json; using unescaped double quotes within a string is not a good idea.

Copy link

williammalo commented Mar 28, 2012

@atk fixd!

Copy link

atk commented Mar 28, 2012

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment