JSFiddle - React, Tailwind, and code Playground

by Chuan Shao

JavaScript

var s = "test";
s.length = 9;
console.log(s.length);//still 4
s.newVariable = 9;
console.log(s.newVariable);//undefined
console.log(s === "test");

var t = new String("test");
t.length = 9;
console.log(t.length);//still 4, as length attribute is read only
t.newVariable = 9;
console.log(t.newVariable);//9

console.log(t == "test");
console.log(t === "test");