Copy link to clipboard
Copied
I want to compute some object components based on a "prompt" input.
Thanks
Some references to common JS math methods:
https://www.w3schools.com/js/js_math.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
Two things to keep in mind:
1) Adobe ExtendScript does not support "modern" features
2) Digits entered into a prompt are returned as a string, not a number:
var input = prompt("enter a number", "2");
alert(input.toSource());
However, in practice, JS often deals with this gracefully:
var input = prom
...
Copy link to clipboard
Copied
Some references to common JS math methods:
https://www.w3schools.com/js/js_math.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
Two things to keep in mind:
1) Adobe ExtendScript does not support "modern" features
2) Digits entered into a prompt are returned as a string, not a number:
var input = prompt("enter a number", "2");
alert(input.toSource());
However, in practice, JS often deals with this gracefully:
var input = prompt("enter a number", "2");
var result = input * 2;
alert(result.toSource());
Hope this helps.