Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createUser(uname: string, pw: string): User {
- if (!(uname && pw))
- throw new Error("Validation failed!");
- return { username: uname, password: pw };
- }
- try {
- createUser("John Doe", "hello123");
- } catch (error) {
- throw error;
- }
Add Comment
Please, Sign In to add comment