javascript to round a calculation result

Oct 18, 2016

I am using triggers to generate an output numeric value (Viscosity) based on an input numeric value and a calculation. The calculation works great, but I would like the output to be rounded to the nearest whole number. I have added a javascript trigger with the code below. I won't know if it works until the module has been uploaded to the LMS, but I'm not even sure I have the right java code. I have pieced this together based on Articulate best practices and W3. Can someone tell me if this looks right?

var Viscosity = Math.round ()

Trigger is...

Action: Execute JavaScript

Script... (this is where I entered the code above)

When: User clicks

Object: Button 3

No conditions.

"Viscosity" is the name of the numeric variable that I would like rounded to the nearest whole number.

Thanks~

 

4 Replies

This discussion is closed. You can start a new discussion or contact Articulate Support.