Skip to Content
Learning TypeScript 2.x - Second Edition
book

Learning TypeScript 2.x - Second Edition

by Remo H. Jansen
April 2018
Beginner content levelBeginner
536 pages
13h 21m
English
Packt Publishing
Content preview from Learning TypeScript 2.x - Second Edition

Comparison operators

TypeScript supports the following comparison operators. To understand the examples, you must assume that variable A holds 10 as value and variable B holds 20 as value:

Operator

Description

Example

==

Checks whether the values of two operands are equal or not. This operator uses type coercion. If yes, then the condition becomes true.

(A == B) is false. A == "10" is true.

===

Checks whether the value and type of two operands are equal or not. This operator doesn't use type coercion. If yes, then the condition becomes true.

A === B is false. A === "10" is false.

!=

Checks whether the value of two operands are equal or not. If the values are not equal, then the condition becomes true. This operator ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering TypeScript - Fourth Edition

Mastering TypeScript - Fourth Edition

Nathan Rozentals
Learning TypeScript

Learning TypeScript

Josh Goldberg
TypeScript for Beginners

TypeScript for Beginners

Bharath Thippireddy

Publisher Resources

ISBN: 9781788391474Supplemental Content