Below I have two examples of code. They are the same except I change the value of w at the beginning. In either example, m has a value. All I'm trying to do is set x = m. Why can I do this in the first but not the second? I'm testing this in the console in Chrome (68.0.3440.84)
This works (m = 100| x = 100)
    var c = [],
     w="word",
     x = 0;
        for (l=0; l<w.length; l++){
         c.push(w.charCodeAt(l));
        }
    
    for (i in c) {
     if (c.length > 0) {
            var m = c[1];
            if (m > Math.min(m, c[i])) {
                m = Math.min(m, c[i]);
       x = m; 
       console.log(x);
            } 
        }
    }This does not work (m = 97| x = 0):
    var c = [],
     w="cancel",
     x = 0;
        for (l=0; l<w.length; l++){
         c.push(w.charCodeAt(l));
        }
    
    for (i in c) {
     if (c.length > 0) {
            var m = c[1];
            if (m > Math.min(m, c[i])) {
                m = Math.min(m, c[i]);
       x = m; //why cant I set this?
       console.log(x);
            } 
        }
    }There is more I want to do but in my process of figuring out this learning problem I have I have been unable to set this variable x reliably and I'm trying to figure out why.
 
     
    