My first JS Technical Interview
I got invited, after an initial interview, to come back for a technical interview for a well respected bootcamp that puts students through a brutal program that is known to turn regular coders into senior software engineers.
- There was a situation where I had to take a negative number and turn it positive. My brain went to...
- Turn the number positive, and save that in a variable
- multiply that number by 2
- add that number to your original number.
- these steps are me imagining it on a number line and moving from left to right.
- Interviewer(joe) showed me that I could have also simply multiplied the negative number by -1... or even more simply used a default JS Math method .abs for Absolute.. feed it a value and it spits out the number in positive form.
- I had to implement my own map function and every function
- it came up often that, since we were using a codebin, I was needing to console.log something.and he showed me that instead of trying to put console.logs inside my functions.. it was better to just wrap an invoked function at the end in a console.log...example... console.log(myAnswer(x))
- He suggested that I always write the most modern js I can. I guess it depends on the company and what browsers you have to support
- I asked him for feedback to make myself stronger. He pointed to Higher Order Functions, Callbacks, Array Methods, and coding challenge websites.
- I told Joe about how I think about the word closure in JS. I think of parent and inner functions as Russian dolls that nest inside each other. With that visual I imagine that the word "closure" would refer to something further inside. Instead that is exactly wrong in lexically scoped languages like JS, so I have to (silly I know) tell myself that nested scope simply works the OPPOSITE of what my intuition tells me.