mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
LibJS: Add basic support for modulo (%) in binary expressions
This commit is contained in:
parent
9c8363bb5f
commit
644ff1bbfd
6 changed files with 25 additions and 0 deletions
|
@ -239,6 +239,12 @@ Value div(Value lhs, Value rhs)
|
|||
return Value(lhs.to_number().as_double() / rhs.to_number().as_double());
|
||||
}
|
||||
|
||||
Value mod(Value lhs, Value rhs)
|
||||
{
|
||||
// FIXME: It seems like JavaScript should allow modulo for doubles as well(?)
|
||||
return Value(lhs.to_i32() % rhs.to_i32());
|
||||
}
|
||||
|
||||
Value typed_eq(Value lhs, Value rhs)
|
||||
{
|
||||
if (rhs.type() != lhs.type())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue