## 6 Answers

Reset to default

# Trending sort

**Trending** sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

You can find `===`

and `!==`

operators in several other dynamically-typed languages as well. It always means that the two values are not only compared by their “implied” value (i.e. either or both values might get converted to make them comparable), but also by their original type.

That basically means that if `0 == "0"`

returns true, `0 === "0"`

will return false because you are comparing a number and a string. Similarly, while `0 != "0"`

returns false, `0 !== "0"`

returns true.

It’s `!=`

without type coercion. See the MDN documentation for comparison operators.

Also see this StackOverflow answer, which includes a quote from “JavaScript: The Good Parts” about the problems with `==`

and `!=`

. (`null == undefined`

, `false == "0"`

, etc.)

Short answer: *always* use `===`

and `!==`

unless you have a compelling reason to do otherwise. (Tools like JSLint, JSHint, ESLint, etc. will give you this same advice.)

Copied from the formal specification: ECMAScript 5.1 section 11.9.5

## 11.9.4 The Strict Equals Operator ( === )

The production

EqualityExpression:EqualityExpression===RelationalExpressionis evaluated as follows:

- Let
lrefbe the result of evaluatingEqualityExpression.- Let
lvalbe GetValue(lref).- Let
rrefbe the result of evaluatingRelationalExpression.- Let
rvalbe GetValue(rref).- Return the result of performing the strict equality comparison
rval===lval. (See 11.9.6)## 11.9.5 The Strict Does-not-equal Operator ( !== )

The production EqualityExpression :

EqualityExpression!==RelationalExpressionis evaluated as follows:

- Let
lrefbe the result of evaluatingEqualityExpression.- Let
lvalbe GetValue(lref).- Let
rrefbe the result of evaluatingRelationalExpression.- Let
rvalbe GetValue(rref).

Letrbe the result of performing strict equality comparisonrval===lval. (See 11.9.6)- If
ristrue, returnfalse. Otherwise, returntrue.## 11.9.6 The Strict Equality Comparison Algorithm

The comparison

x===y, wherexandyare values, producestrueorfalse. Such a comparison is performed as follows:

- If Type(
x) is different from Type(y), returnfalse.- Type(
x) is Undefined, returntrue.- Type(
x) is Null, returntrue.- Type(
x) is Number, then

- If
xis NaN, returnfalse.- If
yis NaN, returnfalse.- If
xis the same Number value asy, returntrue.- If
xis +0 and y is -0, returntrue.- If
xis -0 and y is +0, returntrue.- Return
false.- If Type(
x) is String, then returntrueifxandyare exactly the same sequence of characters (same length and same characters in corresponding positions); otherwise, returnfalse.- If Type(
x) is Boolean, returntrueifxand y are bothtrueor bothfalse; otherwise, returnfalse.- Return
trueifxandyrefer to the same object. Otherwise, returnfalse.

The `!==`

opererator tests whether values are not equal or not the same type.

i.e.

```
var x = 5;
var y = '5';
var 1 = y !== x; // true
var 2 = y != x; // false
```

reference here

!== is the strict not equal operator and only returns a value of true if both the operands are not equal and/or not of the same type. The following examples return a Boolean true:

```
a !== b
a !== "2"
4 !== '4'
```

`!==`

This is the strict not equal operator and only returns a value of true

if both the operands are not equal and/or not of the same type. The

following examples return a Boolean true:

```
a !== b
a !== "2"
4 !== '4'
```

63