Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

48 lines
852 B
Plaintext

== Why is this an issue?
The ``++in++`` operator tests whether the specified property is in the specified object.
If the right operand is a of primitive type (i.e., not an object) the ``++in++`` operator raises a ``++TypeError++``.
=== Noncompliant code example
[source,javascript]
----
var x = "Foo";
"length" in x; // Noncompliant: TypeError
0 in x; // Noncompliant: TypeError
----
=== Compliant solution
[source,javascript]
----
var x = new String("Foo");
"length" in x; // true
0 in x; // true
"foobar" in x; // false
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
TypeError can be thrown as this operand might have primitive type.
=== Highlighting
Primary: The right operand.
Secondary: the operator.
endif::env-github,rspecator-view[]