Menu

(Solved) : 6 Given Two Functions Left Answer Questions Box Right Let Iseven X Number Boolean Return X Q44029912 . . .

6. Given the two functions on the left, answer the questions in the box on the right. let isEven = (x: number): boolean => {

6. Given the two functions on the left, answer the questions in the box on the right. let isEven = (x: number): boolean => { return x % 2 === 0; (a) What will be returned by following func- tion call: getName(3); }; (b) What will be returned by the following function call: getName (4); let getName = (y: number): string => { if (isEven(y)) { return “Michael”; } else { if (y === 4) { return “Dwight”; } else { if (y === 3) { return “Jim”; (c) If there is any unreachable code (i.e. code that can never be reached in any circum- stance), circle it. If there is not, write ”NA” below. return “Stanley”; (d) Make a function call that will result in the value “Stanley” being returned. Show transcribed image text 6. Given the two functions on the left, answer the questions in the box on the right. let isEven = (x: number): boolean => { return x % 2 === 0; (a) What will be returned by following func- tion call: getName(3); }; (b) What will be returned by the following function call: getName (4); let getName = (y: number): string => { if (isEven(y)) { return “Michael”; } else { if (y === 4) { return “Dwight”; } else { if (y === 3) { return “Jim”; (c) If there is any unreachable code (i.e. code that can never be reached in any circum- stance), circle it. If there is not, write ”NA” below. return “Stanley”; (d) Make a function call that will result in the value “Stanley” being returned.

Expert Answer


Answer to 6. Given the two functions on the left, answer the questions in the box on the right. let isEven = (x: number): boolean …

OR