for (let i = 0; i < 4; i++) {
assertEq(dn.of(i + 1), styleTests[i]);
// Also works with strings.
assertEq(dn.of(String(i + 1)), styleTests[i]);
// Also works with objects.
assertEq(dn.of(Object(i + 1)), styleTests[i]);
}
}
}
{
let dn = new Intl.DisplayNames("en", {type: "quarter"});
// Performs ToString on the input and then validates the stringified result.
assertThrowsInstanceOf(() => dn.of(), RangeError);
assertThrowsInstanceOf(() => dn.of(null), RangeError);
assertThrowsInstanceOf(() => dn.of(Symbol()), TypeError);
// Throws an error if |code| isn't an integer.
assertThrowsInstanceOf(() => dn.of(1.5), RangeError);
assertThrowsInstanceOf(() => dn.of(-Infinity), RangeError);
assertThrowsInstanceOf(() => dn.of(Infinity), RangeError);
assertThrowsInstanceOf(() => dn.of(NaN), RangeError);
// Throws an error if outside of [1, 4].
assertThrowsInstanceOf(() => dn.of(-1), RangeError);
assertThrowsInstanceOf(() => dn.of(0), RangeError);
assertThrowsInstanceOf(() => dn.of(5), RangeError);
}
if (typeof reportCompare === "function")
reportCompare(true, true);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.