Question: Hi, i ahve this typescript program but whenever I run the program i get this error message below can you help me fix it error:
Hi, i ahve this typescript program but whenever I run the program i get this error message below can you help me fix it
error:

code:
'use strict'; import * as readline from 'readline';
let inputHandler = readline.createInterface({ input: process.stdin, output: process.stdout });
// Function to print pattern recursively function printPattern(integer: number) { if (integer = 5) { return (printPattern(integer - 1) + " " + integer + printPattern(integer - 1) + " " + " "); } else { return (printPattern(integer - 1) + " " + integer + printPattern(integer - 1)); } } }
// getting user input from the console inputHandler.question("Enter a number between 1 to 15: ", (answer: string) => { // parsing the string input let integerAnswer: number = parseInt(answer, 10); // performing the pattern if (integerAnswer 15) { console.log("Error: Wrong input"); } else { console.log("User input | Program output " + integerAnswer + " | " + printPattern(integerAnswer) + " "); } // closing the handler inputHandler.close(); })
TSError:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
