I need help with these 3 questions with this javascript quiz for a job. I didn’t get the job but would like to find out how it’s done so I can learn. Can anyone help?
Question 1
Write a Javascript class with the following specifications:
1) Class name “fruit”
2) Class takes in an argument “fruitName”
3) a private variable “name” that is set when the class is instantiated
4) a public method “getName” that returns variable “name”
Question 2
Write a piece of Javascript code (jQuery allowed) that finds the various fruit names in the HTML
structure below and stores them in an array variable “fruits”:
<ul id=”fruits”>
<li> Apple </li>
<li> Banana </li>
<li> Orange </li>
</ul>
Question 3
Write a JSON representation of the the variable “fruits”.