You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let a:String = from_value(args.get(0).expect("failed to get argument for String method").clone()).unwrap();
this.set_field_slice("length",to_value(a.len()asi32));
The text was updated successfully, but these errors were encountered:
Describe the bug
Calling new String('some text') does not set the instance
E.g
Should return 4
To Reproduce
Put the above into a test.js file and run it, you should get 0
Expected behavior
it should return 4
Implementation is here:
Master: https://github.com/jasonwilliams/boa/blob/master/boa/src/builtins/string/mod.rs#L31-L49
The string passed in lives at args.get(0), you can call len() then convert it back into a JSValue by calling
to_value()
on it.There's an example commented out here:
https://github.com/jasonwilliams/boa/blob/master/boa/src/builtins/string/mod.rs#L36-L37
The text was updated successfully, but these errors were encountered: