I'm attempting to utilise javascript code using ko...
# javascript
a
I'm attempting to utilise javascript code using kotlin So I created an example.js file in the
src/main/resource
directory and created a function for adding two numbers. And using an external modifier, I created a function with the same name, but nothing happened at the time of use. Help me please.
a
how did you try to use the function?
a
using this:-
Copy code
external fun addNumbers(a: Int, b: Int): Int = definedExternally
d
You have to include the JavaScript file into your HTML (assuming you're targeting browsers)
a
How?
d
I think you can either
require()
it, or include it into your HTML using a
<script>
tag