Write a function frameWord(word, width, height) that puts word in the middle of a frame of stars and returns the whole frame as one string.
word is 1 to 20 Latin letters. width and height are whole numbers: the size of the frame in characters and in lines, the border included.width stars *. Every other line starts and ends with * and has spaces inside.'\n'. There is no '\n' at the end.width is less than word.length + 2 or height is less than 3, the word does not fit: throw a RangeError.A template literal is a short way to build one line of the frame.
console.log(frameWord('cat', 7, 5))Prints ******* | * * | * cat * | * * | *******
frameWord('hi', 7, 3)Returns '*******\n* hi *\n*******'
frameWord('cat', 7, 5)'*******\n* *\n* cat *\n* *\n*******'frameWord('go', 4, 3)'****\n*go*\n****'Hidden tests run on Submit.