Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
403 views
in Client-Side Scripting Using JavaScript by (30.4k points)
closed by

What is an operator? Explain in detail.

1 Answer

+1 vote
by (30.5k points)
selected by
 
Best answer

Operators are the symbols used to perform an operation. 

1. Arithmetic operators:

It is a binary operator. It is used to perform addition(+), subtraction(-), division (/), multiplication(*), modulus(%-gives the remainder), increment(++) and decrement(—) operations. 

Eg. If x=10 and y=3 then

lf x=10 then 

document.write(++x); → It prints 10+1=11 

If x=10 then 

document.write(x++); → It prints 10 itself. 

If x=10 then 

document.write(—x); It prints 10-1=9 

lf x=10 then 

document.write(x—); → It prints 10 itself.

2. Assignment operators: 

If a=10 and b=3 then a=b. This statement sets the value of a and b are same, i.e. it sets a to 3.

It is also called short hands If X=10 and Y= 3 then

3. Relational(Comparison) operators: 

It is used to perform comparison or relational operation between two values and returns either true or false.

Eg: If X=10 and Y=3 then

4. Logical operators: 

Here AND(&&), OR(||) are binary operators and NOT(!) is a unary operator. It is used to combine relational operations and it gives either true or false 

If X=true and Y=false then

Both operands must be true to get a true value in the case of AND(&&) operation If X=true and Y=false then

Either one of the operands must be true to get a true value in the case of OR(||) operation 

If X= true and Y=false then

  !X !Y
false true

5. String addition operator(+): 

This is also called concatenation operator. lt joins(concatenates)two strings and forms a string. 

Eg: var x, y, z; 

x= “BVM HSS; 

y= “Kalparamba”;

z=x+y; 

Here the variable z becomes “BVM HSS Kalparamba”.

Note: If both the operands are numbers then addition operator(+) produces number as a result otherwise it produces string as a result.

Consider the following

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...