Shreyas arya

Generation

generate functionFri, 10 Feb 2023

Create a method to throw an exception if does not print a string

Script function add(a, b) { if(typeof a !== "string" || typeof b !== "string") { throw "Inputs must be a string"; } else { console.log(a + " " + b); } }

Questions about programming?Chat with your personal AI assistant