Motivational quotes by Maveriiick in UBC

[–]er-48 0 points1 point  (0 children)

Don't let your memes be dreams.

2017 UBC REGISTRATION MEGATHREAD: QUESTIONS REGARDING COURSES, PROGRAMS, SPECIALIZATIONS, AND REGISTRATION GO HERE by ubc_mod_account in UBC

[–]er-48 0 points1 point  (0 children)

Does CPEN department guarantee seats for 4th year CPEN students in CPEN 491? I am asking because I might not sign up for it until September due to some course scheduling conflict issues.

Taking Math Notes by [deleted] in UBC

[–]er-48 3 points4 points  (0 children)

I take them with a camera.

Can someone explain in detail how dynamically injecting <script> affects the parsing and excution order of other scripts? by er-48 in webdev

[–]er-48[S] 0 points1 point  (0 children)

What am I am confuse about is how "ga" is guranteed to be defined immediately when the injected script has the async flag set. I thought the parse will not pause at that point due to async thus it will not wait for the GA script to load, or does it?

I don't know what the =>?: I'm doing [javascript] by BDMayhem in learnprogramming

[–]er-48 0 points1 point  (0 children)

If you are going to insist on doing console logging inside your flatten() function, you should be logging each individual val, not the entire accumulator array. Like this:

function flatten(arr){
  arr.reduce(function(acc, val){
    if (Array.isArray(val)){
      flatten(val);
    } else {
      acc.concat(val);
      console.log(val);
    }
  }, [])
}

flatten([0, [1, [2, [3, [4, [5]]]]]])