javascript - Functions In CoffeeScript -


i'm trying convert function javascript coffeescript. code:

function convert(num1, num2, num3) {     return num1 + num2 * num3; } 

but how can in coffeescript?


i'm trying run function html source this:

<script type="text/javascript" src="../coffee/convert.js"></script>  <script type="text/javascript">     convert(6, 3, 10); </script> 

but won't work , error saying: referenceerror: can't find variable: convert

how correct this?

you need export convert function global scope.
see how can coffescript access functions other assets?

window.convert = (num1, num2, num3) ->   num1 + num2 * num3 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -