Call a JavaScript Function from WebAssembly

Guy Bedford
InstructorGuy Bedford

Share this video with your friends

Send Tweet

Using WASM Fiddle, we show how to write a simple number logger function that calls a consoleLog function defined in JavaScript. We then download and run the same function in a local project.

WASM Fiddle:

Demo Repo:

~ 4 years ago

Hi, I'm quite new to C. Why is consoleLog treated as an import while our other function becomes an export? Is it because we used consoleLog inside of another function? And/or because we didn't "finish" declaring it? Thanks.