diff --git a/boa_engine/src/builtins/weak_map/mod.rs b/boa_engine/src/builtins/weak_map/mod.rs index ca96a1913b6..cceacabd3b8 100644 --- a/boa_engine/src/builtins/weak_map/mod.rs +++ b/boa_engine/src/builtins/weak_map/mod.rs @@ -181,11 +181,7 @@ impl WeakMap { // 5. For each Record { [[Key]], [[Value]] } p of entries, do // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return p.[[Value]]. // 6. Return undefined. - if let Some(value) = m.get(key.inner()) { - Ok(value) - } else { - Ok(JsValue::undefined()) - } + Ok(m.get(key.inner()).unwrap_or_default()) } /// `WeakMap.prototype.has ( key )`