mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 12:31:22 +00:00
Add an example using Math
This commit is contained in:
10
examples/math/index.js
Normal file
10
examples/math/index.js
Normal file
@ -0,0 +1,10 @@
|
||||
// For more comments about what's going on here, check out the `hello_world`
|
||||
// example
|
||||
const rust = import("./math");
|
||||
|
||||
rust.then(m => {
|
||||
m.run();
|
||||
console.log('and in JS the answers look like:');
|
||||
console.log(`Math.log2(10.0) = ${Math.log2(10.0)}`);
|
||||
console.log(`Math.sin(1.2) = ${Math.sin(1.2)}`);
|
||||
});
|
Reference in New Issue
Block a user