Thank you for the challenge, I finally got into WebAssembly 🎉
async function makeAdd() { /* * (module * (func $add (;0;) (export "add") (param $var0 f64) (param $var1 f64) (result f64) * local.get $var0 * local.get $var1 * f64.add * ) * ) */ const response = await fetch("data:application/octet;base64,AGFzbQEAAAABBwFgAnx8AXwDAgEABwcBA2FkZAAACgkBBwAgACABoAs=") const buffer = await response.arrayBuffer() const { instance } = await WebAssembly.instantiate(buffer) return instance.exports.add } ;(async function () { const add = await makeAdd() for (var a = -1; a <= 1; a += 1) { for (var b = -1; b <= 1; b += 1) { var s = add(a, b) var ok = s === a + b console[ok ? 'info' : 'warn'](`${ok ? '✅' : '❌'} add(${a}, ${b}) = ${s}`) } } }())
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you for the challenge, I finally got into WebAssembly 🎉