Q:

How to skip undefined value in loop?

This is the log:
0: 89392
1: 4454
2: 196406
3: undefined
4: 181473
5: 35547
6: 26040
7: 102495
8: 96180
9: 20733
10: 33113
11: 86545
12: 25397
13: 4718
14: 40053
15: 51517
16: 9026
17: 26811
18: 63626
19: 18050

Tried:
var casiTestati = filtererdData.map(vd => {
    var testatiValid = vd.data.casi_testati;
    if(testatiValid != "") {
        if(firstRunMap) {
            return vd.data[vd.data.length - 1].casi_testati;
        }
        return vd.data[vd.data.length - 1].casi_testati - vd.data[0].casi_testati;
    }
});

Also tried testing with:
if(!testatiValid) and if(testatiValid = undefined) and if(typeof testatiValid !== 'undefined') {
But I still get undefined value
Actually doing:
if(typeof testatiValid !== 'undefined') {
Gives me all values as undefined

A:

Array#map will always return an array of the same length as the input one - you can't skip any values. There are two easy approaches to this problem.
1.
Use an Array#filter after the map to filter out undefined values (may be slow on large data sets as it requires two loops)
var casiTestati = filtererdData.map(vd => {
    var testatiValid = vd.data.casi_testati;
    if(testatiValid != "") {
        if(firstRunMap) {
            return vd.data[vd.data.length - 1].casi_testati;
        }
        return vd.data[vd.data.length - 1].casi_testati - vd.data[0].casi_testati;
    }
}).filter(vd => vd !== undefined); //<-- filter out undefined values

2.
Use a normal loop or reduce instead of a map and add values to the result array manually 
var casiTestati = filtererdData.reduce((ct,vd) => {
    var testatiValid = vd.data.casi_testati;
    if(testatiValid != "") {
        if(firstRunMap) {
            ct.push(vd.data[vd.data.length - 1].casi_testati);
        }
        ct.push(vd.data[vd.data.length - 1].casi_testati - vd.data[0].casi_testati);
    }
}, []);

Explanation:
From your comments on the other answers, it seems like some of your data has an undefined casi_testati property. You would have to manually check the first and last data[...].casi_testati and simply not push the value in the 2nd case. But in the first case you allow some invalid data and just filter it out afterwards. Both approaches are perfectly OK.

