Q
Why is camel case preferred in JavaScript for variable names?

Answer & Solution

Answer: Option C
Solution:
Camel case ensures consistency and clarity, making it easier to read and understand the code.
Related Questions on Average

How is the following string 'my javascript function' correctly written in camel case?

A). myJavascriptFunction

B). MyJavascriptFunction

C). myJavascriptfunction

D). myJavaScriptFunction

Which statement about camel case is true?

A). It is mandatory in JavaScript

B). It is a common naming convention

C). It is used for class names only

D). It is only used in JavaScript

Which of the following is NOT written in camel case?

A). userName

B). UserName

C). username

D). user_name

How would you convert 'main page title' to camel case?

A). MainPageTitle

B). mainPageTitle

C). mainpageTitle

D). mainPageTitle

What is the importance of using camel case in JavaScript?

A). Increases execution speed

B). Enhances code readability

C). Reduces file size

D). Helps in error debugging

Which of these is a correctly formatted camel case function name?

A). calculateTotalPrice

B). CalculateTotalPrice

C). calculate_total_price

D). calculateTotalprice

Which of these variable names is not written in camel case?

A). firstName

B). FirstName

C). first_name

D). firstNameExample

In JavaScript, which of the following is the camel case version of 'employee salary'?

A). employeesalary

B). EmployeeSalary

C). employeeSalary

D). Employee_Salary

Which variable name follows camel case convention?

A). studentName

B). StudentName

C). student_name

D). STUDENT_NAME

What is the camel case equivalent of 'total cost'?

A). TotalCost

B). totalCost

C). totalcost

D). total_cost