Xah Web Dev Blog

changed all console log to assert.

xtodo
xtodo

updated.

updated.

updated.

added print to pages with code example of simple expression. e.g. now has console.log or console.assert. because, code example with just expression is intuitive to illustrate some syntax, but often does not make sense as a independent script. e.g. if you have multiple expression, each on a line, e.g.

js simple expression code sample 2026-02-03 1eb69
js simple expression code sample 2026-02-03 1eb69

in real life, such code of just expression per line does not exist, in fact maybe invalid code due to missing semicolon.

So now, add console.log to print them. This gives the code more of intention. in many cases, console.assert instead console.log, it indicate a particular property we are trying to illustrate.

also, general update on content.

major updates. lots major rewrites.

lots livestream on js in past weeks.

updated.

supreme js fp

supreme js fp 2026-01-29 2cf2d
supreme js fp 2026-01-29 2cf2d
/* xah_codepoint_to_utf16_hexStr(zcodepoint) return a string of hexadecimal that's the UTF-16 encoding of the char of codepoint zcodepoint (integer). */

// before

const xah_codepoint_to_utf16_hexStr = (zcodepoint) => {
 const xCharStr = String.fromCodePoint(zcodepoint);
 if (zcodepoint < 2 ** 16) {
  return xCharStr.charCodeAt(0).toString(16).toUpperCase();
 } else {
  const xout = [];
  for (let i = 0; i < xCharStr.length; i++) {
   xout.push(xCharStr.charCodeAt(i).toString(16).toUpperCase());
  }
  return xout.join(" ");
 }
};

// after

const xah_codepoint_to_utf16_hexStr = (zcodepoint) =>
 ((xstr) => (Array.from(Array(xstr.length).keys(), (x) => (xstr.charCodeAt(x).toString(16).toUpperCase())).join(" ")))(String.fromCodePoint(zcodepoint));

🟒 TIP: treat js array-like thing as a monster. Whenever you see it, convert it to true array as soon as possible. this way, you don't have to deal with its special behaviors.

JavaScript design problem. Property Descriptor default values

const xx = { "a": "a", "b": "b" };

const yy = Object.create(Object.prototype, { "a": { value: "a", writable: true, enumerable: true, configurable: true }, "b": { value: "b", writable: true, enumerable: true, configurable: true } });

console.log(xx);
// { "0": "a", "1": "b" }

console.log(yy);
// { "0": "a", "1": "b" }

another mega update




more massive updates

updated

massive updates

replaced all Object.prototype.hasOwnProperty by Object.hasOwn

lots major updates

mega updates.

xtodo

JavaScript abomination, or rather, the abomination of references in programing languages

in JavaScript, regex is always new, never equal.

// JavaScript abomination, or rather, the abomination of references
// regex object are never equal

console.log(RegExp("x") === RegExp("x"));
// false

console.log(RegExp("x").source === RegExp("x").source);
// true

in which programing language regex are never equal, like in JavaScript (/πŸ¦‹/ === /\u{1F98B}/)

in which programing language regex are never equal, like in JavaScript (/πŸ¦‹/ == /x/)

xtodo