ES6 : JS update course

    var name = "foulen"
    
    var ages = [45 , 45 , 45 , 78 , 7]
    const pi = 3.14
    
    console.log(pi)
    /*
    function sayHi() {
        console.log("hello azer")
    }
    */
    
    const sayHi = () => {
        console.log("hello azer")
    }
    /*
    function sayHi2(name) {
        console.log("hi " + name)
    }
    */
    let names1 = ["azer" , "amine" , "ons"  ]
    let names2 = ["arsalen" , "haythem" , "siAla" ]
    
    let names = [...names1 , names2 ]
    
    
    console.log(names)
    //[Tn-arabic] ES6 part 6 : function spread input
    
    const myFunction = (name , ...data) => {
        console.log(data[1])
        console.log("the name is " + name)
    }
    
    myFunction("azer" , "mohamed" , "salim" , 5 , 78)
    let names = ["azer" , "amine" , "ons" , "gharbi" , "siAla"]
    
    for(let i = 0 ; i < names.length ; i++){
        if(names[i][0] != "a"){
            console.log(names[i])
        }
        else{
            console.log("this *a persone !")
        }
    }
    let names = ["azer" , "amine" , "ons" , "gharbi" , "siAla"]
    
    let goodNames = names.filter((name) => {
        return name[0] != "a"
    })
    
    console.log(goodNames)
    let ages = [8 , 12 , 25 , 5] 
    /*
    let total = ages[0]
    
    for(let i = 1 ; i < ages.length ; i++){
        total = total + ages[i]        
    }
    
    console.log(total)
    
    */
    
    var total = ages.reduce((accum , age , index) => {
        return accum + age
    // for of loop
    
    let names = ["azer" , "amine" , "ons" , "gharbi"]
    
    for(let name of names){
        console.log(name)
    }
    // for in 
    
    let user = {
        name : "azer" ,
        age : 20 ,
        id : 46456 ,
        alive : true
    }
    
    for(let userData in user){
        console.log(user[userData])
    }

learn es6