xtodo JavaScript js

xtodo

String.raw Property???

The first argument has a property key "raw". Its value is the raw string.

js module name space object 2026-07-15 16c9b ll
js module name space object 2026-07-15 16c9b ll

make functional programing example

  • search “Function form lets you manipulate expressions”. e.g. reflect.get page. create a new page showing example. and all pages link to it.
YouTube stars flying 2025-05-12
YouTube stars flying 2025-05-12
  • 2025-04-29
  • JavaScript fix snow fall page. make it all just fall, no bounce back.
  • make it number of flakes according to screen size
  • JS DOM: Falling Snow Effect
js iterator 2025-04-26 192d7
js iterator 2025-04-26 192d7
const xx = Array(4).fill(0).map((x, i) => x + i);
console.log(xx);
// [ 0, 1, 2, 3 ]

// yy = xx[Symbol.iterator];

// console.log( yy )

// console.log( yy() .next() )

console.log( xx[Symbol.iterator]().next(), );
// { value: 0, done: false }

console.log( xx[Symbol.iterator]().next(), );
// { value: 0, done: false }

/*
the complex javascript iterator generator interface fucks.

here, first is the complexity of no range function.
you got the fill method patch to deal with that.

then, am trying to deconstruct the iteratable interface, trying to get its next value.
but apparantly it resets.

very complex, because the iterable contains a property of type symbol, named Symbol.iterator.
it's value must be a function.
and it must return a object, this object must have a next property, and this property's value must be a function.
this is why u get this funky
xx[Symbol.iterator]().next()

its return value, is a object, that contains value and done keys.

yet, somehow it resets. am unable to get it to 0, 1, 2, 3, etc.
 */

JavaScript

xtodo

js walk dir

Georrg, 11/03/2022 @XahLee standard library has walk and walkSync functions

import { walkSync } from "https://deno.land/std@0.162.0/fs/walk.ts";

for (const entry of walkSync(".")) {
console.log(entry.path);
}
js TypeScript george 2022-04-19
JavaScript TypeScript george 2022-04-19
js todo 2021-11-21 tmKkW
JavaScript todo 2021-11-21 tmKkW

missing some. create new page for them.

js this-binding argument

bryan forbs js 2026-02-01 2a969
bryan forbs js 2026-02-01 2a969
// nasty problem in JavaScript involving this-binding

function MakeObj(x) {
this.p = x;
return "lol";
}

function OhMyGodMakeObj(x) {
this.p = x;
return {};
}

const niceObj = new MakeObj(3);
console.assert(niceObj.p === 3);

const godObj = new OhMyGodMakeObj(3);
console.assert(godObj.p === 3, "omg, no work");
// Assertion failed: omg, no work
// oddity in JavaScript involving this-binding.
// a magic “this” bultin var, nothing to do with object oriented programing.

function addone(x) {
return this + x;
}

console.assert(addone.call(3, 4) === 7);

/*
this means, people can write all functions this way,
and the new call syntax is
funname.call(args...)
instead of just
funname.(args...)
*/

/*

the problem here is, in typical programing engineering fashion of speaking, JavaScript leaked the this-binding mechanism for its so-called dispatch in its object-oriented way.

it should generate a error instead, when function use this-binding without being a method.

*/

todo stuff