Skip to content
← Back to Community
A simple calculator
Profile icon
sojs

A normal calculator. That can do most mathematical functions such as sqrt() and can even run javascript if you enclose it with function(){ //code goes here }
Have fun!

Voters
Profile icon
Pythonier
Profile icon
Acer123
Profile icon
sojs
Comments
hotnewtop
Profile icon
Highwayman

Are you sure it can’t
697346F6-B0B9-428D-875F-B3DBC2E72EBB

Profile icon
sojs

@Highwayman
I meant plain sqrt(); I tried Math.eval() and

with(math){ eval(x) }

but they both did not work

Profile icon
Highwayman

@sojs
it’d more be like

... const sqrt = Math.sqrt; x = r("equation: "); eval(x)
Profile icon
sojs

@Highwayman
That is genius. I never thought of that. Thanks!

Profile icon
sojs

@Highwayman
Actually, that will not work because eval() only evaluates code in the string and does not use or interact with variables in the global namespace.

Profile icon
Highwayman

@sojs
are you sure? That’s the entire point of eval though. It does work, just try it.

Profile icon
sojs