#jskatas

2024-09-26

**Homework**
How would you "read" the second result from the generator?

Or practice the yield expression and many more things on:
All the katas – jskatas.org
Kata on generators – jskatas.org/katas/es6/language

#Learn #JavaScript with #tests
#jskatas

2024-03-29

I released my first article aimed at those new to #JavaScript, titled 'Learning JavaScript Arrays.' It adopts a test-driven style, inviting readers to solve small tests within the article.

πŸ‘‰ jskatas.org/blog/2023/09/29-le

I saw the array section on jskatas be most used, so I thought maybe lets dive a bit deeper and I brought arrays, the knowledge and the test approach together. What do you think? I would love to get feedback.

#learning #JavaScript #jskatas #tests #testdriven

2023-10-14

1️⃣ The property `function.length` indicates the number of parameters a function expects

WHEN reading `length` of a function without parameters
THEN it is 0

WHEN a function is defined with two parameters
THEN length reports 2

WHEN calling the function with 0 parameters
THEN the length still indicates the expected number of parameters

Here we go two #JavaScript katas #jskatas about `function.length`

ES1: jskatas.org/katas/es1/language
ES6: jskatas.org/katas/es6/language

2023-10-11

Interesting, `array.shift()` was introduced in ECMAScript 3 [1] in 1999, see chapter 15.4.4.9. At least it's not part of the v2 spec [2] from 1998. In v2 the last chapter in 15.4.4 is 15.4.4.5.

Expect a #jskata on `array.shift()` to come soon.

[1] ecma-international.org/wp-cont
[2] ecma-international.org/wp-cont

#JavaScript #specification #jskatas

2023-10-09

πŸ‘€ You're a newbie, JSKatas takes you by the hand and helps you learn at your speed! Start with an easy kata [1] to get the hang of it and find out if you like it. For example learn how to declare a variable [2].

[1] jskatas.org/katas/groups/level
[2] jskatas.org/katas/es6/language

#learn #JavaScript #jskatas

πŸ‘€ You're a newbie, JSKatas takes you by the hand and helps you learn at your speed! Start with an easy kata to get the hang of it and find out if you like it. For example learn how to declare a variable.
2023-10-09

I released one new kata, a kata about `String.raw`. πŸŽ‰
❓ What is it?
`String.raw` is a tag function for a template literal, which returns the raw string, e.g. \\n (not \n) for a line break. [1]

🧐 I find it hard to explain what it is. I also feel this is a very edge case thing, just like Reflect, not many seem to know and use it.
Feedback is very welcome.

[1] jskatas.org/katas/es6/language

#JavaScript #learning #tests #jskatas

2023-10-08

A new #jskatas rabbit hole found `String.raw`.
Actually I was trying to understand and improve the template-strings-raw kata [1], but that led me to learn (again) what `String.raw` [2] is actually good for, and even more important why the array of strings passed to a tag-function gets a `raw` property.

❓ How much relevance does this feature have? πŸ€·πŸ»β€β™€οΈ

πŸ§‘πŸ½β€πŸŽ“ Anyways, I like digging into it to understand it. πŸ’‘

[1] jskatas.org/katas/es6/language
[2] developer.mozilla.org/en-US/do

#JavaScript #learning #withTests

2023-10-01

Hab mir mal den Schedule der c't webdev @ctwebdev angeschaut ctwebdev.de/agenda2023/ und ich bin immer wieder ziemlich irritiert wie wenig Rolle eigentlich JavaScript als Sprache spielt, es geht immer um alles was oben drauf gesetzt wird.

Aber gut, umsonst mache ich ja nicht sowas wie #jskatas und #jslang, weil ich denke dass zuviel Potential, das mit der Sprache noch ausgeschΓΆpft werden kΓΆnnte, auf der Strecke bleibt.

2023-09-29

...
We're all about getting your hands dirty with real-world coding challenges! πŸ€“
jskatas.org

🎯 Sharpen Your #Skills with Focused Drills 🎯
Consolidate your existing knowledge and push your skills to the next level! πŸ“ˆ
Take Control of Your Learning Journey #JSKatas empowers you to actively engage with #JavaScript, offering a learning experience that's as unique as you are! 🌈
jskatas.org

2023-09-27

πŸŽ‰ In the new jskatas.org one can edit the tests right on the page now.
ℹ️ This allows you to stay focused and keep the kata in sight and finish right where you learn.
πŸŽ™οΈ The mission of #jskatas is to allow to continuously #learn #JavaScript your way.
πŸ§ͺ Using tests 😎

2023-09-04

Three new katas about "Bitwise Shift Operators" have just been released to #jskatas

- All bitwise shift operators
- Left Shift "<<"
- Right Shift ">>"

[1] jskatas.org/katas/versions/chr

#learn #JavaScript #YourWay

Bitwise Shift Operators
Left Shift "<<"
#new
Right Shift ">>"
#new
All bitwise shift operators
#easy
#new
2023-09-02

```
assert.strictEqual('1e4' >> ['0b11'], expected);
```

`expected` is?

#JavaScript #kata #jskatas

2023-09-02

it('shifting BigInt can be any huge number, even larger than 32bits', () => {
const bigInt = 1n << 255n;
assert.equal(bigInt.toString(2), '100000000000000000000000000000000000000000000000000000000000000.......');
});

#jskatas

it('shifting BigInt can be any huge number, even larger than 32bits', () => {
    const bigInt = 1n << 255n;
    assert.equal(bigInt.toString(2), '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
  });
2023-08-28

Follow me into a new rabbit hole.

I am starting a kata (or many katas) on bit shifting (operations/operators). I am working on a lot of C code during the day where this is a usual thing to do and I often struggle with understanding the reasoning, so I thought why not just write it for #jskatas.

tbc

2023-08-28

Online I see there are three #jskatas on unary operators [1] for #JavaScript, and in the repo I see that I have bigger plans, at least six seem to be prepared.
Looks like I am good in filling a backlog.

I vaguely remember how deep the rabbit hole started to look when I wrote "What's an "Unary" Operator?" [2].

[1] jskatas.org/katas/versions/chr
[2] jskatas.org/blog/2021/02/06-wh

unary-operators

all.js
chaining.js
logical-not.js
minus.js
plus.js
plus-in-depth.jsUnary Operators
All unary operators
#easy
Unary "+" operator
Unary "+" operator, in depth
2023-08-28

I had not remembered that I did actually already create one #BigInt #kata to learn the basics of it.

In #ES11 or #ES2020 or just #JavaScript 2 years ago it was released. Wanna learn it too? Feel free to fix some failing tests and hopefully learn actively how BigInt works.

jskatas.org/katas/es11/languag

#jskatas

BigInt: Basics
A BigInt can represent numbers larger than number

A BigInt is a large number 
a number: Number.MAX_VALUE * Number.MAX_VALUE, is useless, it results in Infinity
a bigint: BigInt(Number.MAX_VALUE) * BigInt(Number.MAX_VALUE) results in an amazingly large AND usable number
the result of BigInt(Number.MAX_VALUE) * BigInt(Number.MAX_VALUE) has 617 digits
creating one can be done in multiple ways 
adding an n at the end of a number
calling the function BigInt(x), where x is a number
calling the function BigInt(x) with a string
calling the function BigInt(x) with a binary number
difference to a number 
a BigInt is of type "bigint"
comparing via == can coerce a bigint to a number
but type safe comparisons fail
a bigint can NOT be used with Math.* functions
can not be calculated with a number
BigInt supports various operators 
the + and - work just like for numbers
also * and / work
the modulo operator % works as known
the exponentiation operator ** works like on numbers
but ++ even throws a SyntaxError
the comparison operators work, even with numbers 
comparing 2n >= 2 works as if they were of the same type
the number can also be the left operand 1 < 2n, works as if they were the same type
explicit type conversion 
via String(0n) renders the number without a trailing n
for Boolean(0b01n) everything but a 0 zero is true
the API 
BigInt is NOT a constructor, it throws
BigInt.asIntN() returns a bigint that can fit in the given number of bits
BigInt.asUintN() uses the g...

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst