Ask Question
14 December, 08:45

If totalMonths has a string value of "13", what does the code that follows display? var years = parseInt (totalMonths / 12); var months = totalMonths % 12; if (years = = 0) {alert (months + " months."); } else if (months = = 0) {alert (years + " years"); } else {alert (years + " years, and " + months + " months.");

}a) 1 years, and 1 monthsb) 1 year, and 1 monthc) 1 yearsd) 1 year

+3
Answers (1)
  1. 14 December, 11:08
    0
    The answer to this question is "Option a".

    Explanation:

    The description of the jа vascript code as follows:

    In the code, there is two variable defined that are "years and months". The years convert string value in number and calculate years and holds value in years variable and months variable calculate the moths and holds value in months variable. Then we use conditional statements in this statement we use two if blocks. In first if block we check that years variable value is equal to 0. if this condition is true. it will print months in the alert box. In second if block we check that if months variable value is equal to 0. if this condition is true. it will print years in the alert box. In else block, we use an alert box that prints years and months.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “If totalMonths has a string value of "13", what does the code that follows display? var years = parseInt (totalMonths / 12); var months = ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers