[Javascript]Javasriptでtomorrow取得

Javasriptでtomorrow取得

            const today = new Date();
            
            const tomorrow = new Date(today);
            tomorrow.setDate(tomorrow.getDate() + 1);

            const yyyyTomorrow = tomorrow.getFullYear();
            let mmTomorrow = tomorrow.getMonth() + 1;
            let ddTomorrow = tomorrow.getDate();
            const yyyymmddTomorrow = yyyyTomorrow + "," + mmTomorrow + "," + ddTomorrow;
            console.log('yyyymmddTomorrow:'+yyyymmddTomorrow);

            var endDate = new Date(yyyymmddTomorrow);
            console.log('endDate:'+endDate);

[JavaScript]forEachで、Uncaught SyntaxError: Illegal break statementエラー時の対応

forEachで、Uncaught SyntaxError: Illegal break statementエラー時の対応

修正箇所。

forEach -> some

break -> return true

//修正後
docs.some(doc => {
    if(data == Id){
        return true;
    }
}


//修正前:Uncaught SyntaxError: Illegal break statementエラー
docs.forEach(doc => {
    if(data == Id){
        break;
    }
}