Pages

passage des paramètres

Ecrire les valeurs affichées



const testPassagePara = function(args) {

    let start = args;
    
    return [start];

}

console.log(testPassagePara(1))

//-------------------------------------------
const testPassagePara = function(args) {

    let start = args;
    
    return [start];

}
console.log(testPassagePara())

//-------------------------------------------
const testPassagePara = function(args=-1) {

    let start = args;
    
    return [start];

}

console.log(testPassagePara())

//-------------------------------------------
const testPassagePara = function(...args) {

    let [start,end,step] = args;
    
    return [start,end,step];

}
console.log(testPassagePara(1, 5, 2, -1))

//-------------------------------------------
const testPassagePara = function(...args) {

    let [start,end,step] = args;

    return {start,end,step};
}


console.log(testPassagePara(1, 5, 2, -1))

//-------------------------------------------
const testPassagePara = function(...args) {

    let [start,end,step] = args;

    return {start,end,step};
}


console.log(testPassagePara(1))

//-------------------------------------------
const testPassagePara = function(...args) {

    let [start=0,end=0,step=1] = args;

    return [start,end,step];
}


console.log(testPassagePara(1))