(SOLVED) - What am I missing? (syntax problem?)

@russian-dima all options above checked and normal, as expected. Also, running your latest code I get this:
An error occurred in one of datasetReady callbacks TypeError: Cannot read property ‘toString’ of null

And againl: why would the let count = $w( “#dataset1” ).getTotalCount(); work inside the export function and not in the on.Ready()??

export function table1_dataChange(event) {
 let count = $w("#dataset1").getTotalCount(); 
        console.log(count) <-- THIS ONE GIVES ME 445, ALL GOOD.
        $w("#counter").text = String(count);
}

But this one, returns NULL:

$w.onReady (function() {
    $w("#dataset1").onReady(() => {
 let count = $w("#dataset1").getTotalCount(); 
        console.log(count)<-- NULL