Sass Equality Operators
What is Equality Operators?
The equality operators return a Boolean indicates whether or not two values are the same.
SASS Equality Operators
The following table provides a list of equality operators available in JavaScript.
Operator | Explanation | Operation | Result |
---|---|---|---|
== | Equal to | 1px == 1px | true |
!= | Not equal to | 1px != 1em | true |
Equality Operators for Numbers
Numbers are equal if they have the same value and the same units, or if their values are equal when their units are converted between one another.
Example
Equality Operators for Strings
Strings are unusual in that unquoted and quoted strings with the same contents are considered equal.
Example
Equality Operators for Colors
Colors are equal if they have the same red, green, blue, and alpha values.
Example
Equality Operators for Lists
Lists are equal if their contents are equal.
Note: Sass has following rules in checking equality between list
- Comma-separated lists aren’t equal to space-separated lists.
- Bracketed lists aren’t equal to unbracketed lists.
Example
Equality Operators for Maps
Maps are equal if their keys and values are both equal.
Example
Equality Operators for true, false, and null
true, false, and null are only equal to themselves.
Example
Equality Operators for Functions
Functions are equal to the same function. Functions are compared by reference, so even if two functions have the same name and definition they’re considered different if they aren’t defined in the same place.
Example
Reminder
Hi Developers, we almost covered 99.1% of Sass Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in Sass.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.