From 5e2b3d53917bb6a39dbffd0db6888bacaa283536 Mon Sep 17 00:00:00 2001 From: Aymen Dirar Date: Sun, 23 Oct 2022 23:29:34 -0700 Subject: handle negative --- entries/adirar111/wasm/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'entries/adirar111') diff --git a/entries/adirar111/wasm/index.js b/entries/adirar111/wasm/index.js index 43ee9a6..667ff82 100644 --- a/entries/adirar111/wasm/index.js +++ b/entries/adirar111/wasm/index.js @@ -10,8 +10,10 @@ WebAssembly.instantiateStreaming(fetch(wasmBinaryDataURL)).then( const result = document.getElementById("result") const n = parseInt(input.value) if (isNaN(n)) { - result.textContent = "that's not a number..." - return + return result.textContent = "that wasn't very wasm of you" + } + if (n < 0) { + return result.textContent = "why are you being so negative" } result.textContent = fibWasm(n) } -- cgit v1.2.3-70-g09d2