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
andylamax
01/12/2023, 7:29 AM
how did you try to use the function?
a
Anant Kumar Gupta
01/12/2023, 7:35 AM
using this:-
Copy code
external fun addNumbers(a: Int, b: Int): Int = definedExternally
d
Derek Ellis
01/12/2023, 1:32 PM
You have to include the JavaScript file into your HTML (assuming you're targeting browsers)