JavaScript is a popular programming language that is used to create interactive web pages. It is a powerful language that…