Work with complex numbers, fractions, units, matrices, symbolic computation, etc. A long standing library now, but continuing to get frequent updates. GitHub repo.
Jos de Jong
Are you passionate about JavaScript? Do you want to stay updated on the latest news, articles, books, and updates in the world of #javascript? Look no further than our resourceful newsletter - JavaScript! This channel is dedicated to providing you with valuable information about everything related to JavaScript, so you never miss out on any important updates. We also offer fun quizzes to test your knowledge and engage with other members of the community. Join us today and be part of the conversation! Let's chat and learn together at @nairihar. Don't miss out on the opportunity to expand your JavaScript knowledge and network with like-minded individuals. Stay informed, stay connected with JavaScript!
02 Dec, 15:32
02 Dec, 07:01
const obj = {
a: 1,
b: function() {
return this.a;
}
};
const b = obj.b;
console.log(b());
01 Dec, 14:30
30 Nov, 13:35
30 Nov, 06:30
const obj = { a: 1 };
Object.seal(obj);
obj.b = 2;
console.log(obj.b);
28 Nov, 06:30
const obj = {};
Object.defineProperty(obj, "prop", {
value: 42,
writable: false
});
obj.prop = 100;
console.log(obj.prop);
27 Nov, 13:24
27 Nov, 06:30
const x = (() => {
try {
return 10;
} finally {
return 20;
}
})();
console.log(x);
26 Nov, 13:23
26 Nov, 06:30
const arr = [1, 2, 3];
arr[-1] = 10;
console.log(arr.length, arr[-1]);
24 Nov, 12:30
23 Nov, 07:48
22 Nov, 07:49
22 Nov, 06:30
const obj = {
valueOf: () => 42,
toString: () => "Hello"
};
console.log(`${obj}`, obj + 10);
20 Nov, 07:47
18 Nov, 05:02
17 Nov, 12:02
17 Nov, 06:30
console.log([…({ [Symbol.iterator]: function*(){ yield *[1, yield *[2,3] ] } })])
16 Nov, 11:58
16 Nov, 06:31
Number.prototype[Symbol.iterator] = function*() { yield *['a','b','c'] };
console.log([...1]);
15 Nov, 04:56
12 Nov, 13:49
12 Nov, 06:30
const arr = [1, 2, 3];
arr[10] = 11;
console.log(arr.length);
11 Nov, 06:30
const name = "Alice";
const obj = {
name: "Bob",
getName() {
return this.name;
}
};
console.log(obj.getName.call({ name: "Charlie" }));
10 Nov, 06:30
const sym1 = Symbol("id");
const sym2 = Symbol("id");
console.log(sym1 === sym2);
09 Nov, 13:05
09 Nov, 06:30
let name = "Alice";
(function() {
let name = "Bob";
console.log(name);
})();
console.log(name);
08 Nov, 13:03
??=
nullish coalescing assignment operator snuck into JavaScript a few years ago via ECMAScript 2021 and has been broadly supported almost everywhere for ages. Trevor shows off how it can tighten up your assignments here.07 Nov, 06:30
const arr = [1, 2, 3];
const copy = [...arr];
copy.push(4);
console.log(arr);
console.log(copy);
06 Nov, 13:53
06 Nov, 06:30
async function test() {
return (await Promise.resolve(0)) || 10;
}
test().then(console.log);
05 Nov, 13:24
05 Nov, 06:30
const obj = { value: 10 };
const result = (obj.value += 5) && obj.value;
console.log(result);
04 Nov, 13:44
04 Nov, 06:30
const factorial = (function () {
const cache = {};
return function inner(n) {
if (n in cache) return cache[n];
return (cache[n] = n <= 1 ? 1 : n * inner(n - 1));
};
})();
console.log(factorial(5));
console.log(factorial(5));
03 Nov, 13:22
03 Nov, 06:30
function Person(name) {
this.name = name;
this.sayName = () => console.log(this.name);
}
const person1 = new Person('David');
const person2 = { name: 'Not David', sayName: person1.sayName };
person2.sayName();
02 Nov, 06:30
const a = false || 0 || "" || null || "JavaScript";
console.log(a);
31 Oct, 13:21
31 Oct, 06:30
function memoize(fn) {
const cache = {};
return (arg) => cache[arg] ?? (cache[arg] = fn(arg));
}
const square = memoize((n) => n * n);
console.log(square(5));
console.log(square(5));
console.log(square(6));
30 Oct, 13:43
30 Oct, 06:30
console.log('A');
setTimeout(() => console.log('B'), 0);
Promise.resolve()
.then(() => {
console.log('C');
return Promise.resolve();
})
.then(() => console.log('D'));
console.log('E');
29 Oct, 13:07
29 Oct, 06:30
console.log(typeof null);
console.log(typeof function () {});
28 Oct, 13:34
28 Oct, 06:30
const obj = {
value: 10,
getValue: function () {
return () => this.value;
}
};
const value = 20;
const getValue = obj.getValue();
console.log(getValue());
27 Oct, 06:30
function Animal(name) {
this.name = name;
}
Animal.prototype.sound = 'Generic sound';
const dog = new Animal('Dog');
Animal.prototype.sound = 'Bark';
console.log(dog.sound);
26 Oct, 13:35
26 Oct, 06:30
async function test() {
console.log(1);
await new Promise(resolve => setTimeout(resolve, 1000));
console.log(2);
return 3;
}
console.log(4);
test().then(console.log);
console.log(5);
24 Oct, 15:45
require()
by default, drops 32-bit Windows support, and node --run
goes stable.24 Oct, 06:30
function Person(name) {
this.name = name;
}
Person.prototype.greet = function () {
console.log(`Hello, ${this.name}`);
};
const person = new Person('Alice');
person.greet();
console.log(person.hasOwnProperty('greet'));
23 Oct, 13:51
23 Oct, 06:30
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 100);
}
22 Oct, 13:42
npx is-my-node-vulnerable
22 Oct, 06:30
const sym = Symbol('unique');
const obj = {
[sym]: 'Secret',
public: 'Visible'
};
console.log(Object.keys(obj));
console.log(obj[Symbol('unique')]);
21 Oct, 06:30
Promise.resolve(1)
.then(value => {
console.log(value);
throw new Error('Something went wrong');
})
.then(() => {
console.log('This will not run');
})
.catch(error => {
console.log('Caught:', error.message);
return 42;
})
.then(value => {
console.log('Recovered with:', value);
});
19 Oct, 06:02
18 Oct, 13:17
18 Oct, 06:30
const map = new Map();
const key1 = {};
const key2 = key1;
map.set(key1, "Value for key1");
map.set(key2, "Value for key2");
console.log(map.get({}));
console.log(map.get(key1));
17 Oct, 13:49
17 Oct, 06:30
const obj = {};
Object.defineProperty(obj, 'name', {
value: 'Alice',
writable: false,
configurable: false
});
try {
obj.name = 'Bob';
delete obj.name;
console.log(obj.name);
} catch (e) {
console.log('Error:', e.message);
}
16 Oct, 06:30
function processData({ a = 10, b = 20 } = { a: 30 }) {
console.log(a, b);
}
processData({ a: 5 });
processData();
15 Oct, 06:30
function* numberGenerator() {
let i = 0;
while (i < 3) {
yield i++;
}
}
const gen = numberGenerator();
console.log(gen.next().value);
console.log(gen.return(10).value);
console.log(gen.next().value);
14 Oct, 06:31
const obj = Object.freeze({
name: "Alice",
info: {
age: 25
}
});
try {
obj.name = "Bob";
obj.info.age = 30;
} catch (e) {
console.log("Error:", e.message);
}
console.log(obj.name, obj.info.age);
13 Oct, 13:22
13 Oct, 06:30
async function first() {
console.log('First Start');
await second();
console.log('First End');
}
async function second() {
console.log('Second Start');
}
console.log('Script Start');
first();
setTimeout(() => console.log('Timeout'), 0);
console.log('Script End');
12 Oct, 13:20