assert_with_condition_and_data function

A false assertion prints an array of objects to the console without interrupting execution of subsequent code. The string representations of each of these objects are appended together in the order listed and output.

Example


     #[wasm_bindgen(start)]
     pub fn main() -> Result<(), JsValue> {
          let x=5u32;
          let y=10u32;   
          let z=15u32; 
          let array = js_sys::Array::new();
          array.push(&"Assertion Failed".into());
          //Assertion passed                                
          web_sys::console::assert_with_condition_and_data(x<y,&array);
          //Assertion failed                                
          web_sys::console::assert_with_condition_and_data(z<y,&array); 
          Ok(())
     }                                
               

Syntax


               pub fn assert_with_condition_and_data(condition: bool, data: &Array)
          
features/dependencies

Source Code
  • web-sys_console_assert.zip
  • GitHub Source