1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script>
<script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script>
<script type="module">
let
mapErreur = new Map( [
[ "4-L-1", "0" ],
[ "3-L-2", "1" ],
[ "5-L-3", "2" ],
[ "1-L-2", "3" ],
[ "7-L-1", "4" ],
[ "9-L-2", "5" ],
[ "6-L-1", "6" ],
[ "8-L-2", "7" ]
] ),
mapResult = new Map();
for ( let[ key, value ] of mapErreur ){
if ( key.match( /L\-2$/ ) ){
mapResult.set( key, value );
}
}
console.log( mapResult );
// Map { "3-L-2" => "1", "1-L-2" => "3", "9-L-2" => "5", "8-L-2" => "7" }
</script> |
Partager