Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function printOperations(a, b) {
- if (typeof a !== 'number' || typeof b !== 'number') {
- throw new Error('Both arguments must be numbers!');
- }
- console.log(a + b, a / b);
- }
- // The function call below should print: 12 1
- printOperations(6, 6); //if string is entered, the above custom error message will be printed
- function exclaim(name, count) {
- for (let i = 0; i < count; i += 1) {
- console.log(`${name}!`);
- }
- }
- // Exclaim 'Muriel!' six times
- exclaim('Muriel', 6); //order must be correct - string and then number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement