mardi 12 juin 2018

how can I turn this into a for loop

Is it possible to make a for loop with the if statement below? And how do I do that? I have 7 of those if statements and the only thing I change is the number "1" at the end of variables.

Tank you

table.js

     if($td.hasClass("tableRow1") && $td.hasClass("Clickable")){
        $cleanDate1 = $date1.substr(17);
        $b1 = "20";
        $position1 = 6;
        $output1 = [$cleanDate1.slice(0, $position1), $b1, $cleanDate1.slice($position1)].join('');
        $newdate1 = $output1.split("-").reverse().join("-");
        console.log($newdate1);
        $('#testdate').html($newdate1);
        document.getElementById("datum").value = $newdate1;
    }

Aucun commentaire:

Enregistrer un commentaire