how to throw error in function javascript code example Example: js throw error throw new Error('Whoops!')