Need Js/jQuery expert

Hi devs!
I need help of Js/jQuery expert. I am doing my first tech interview in Js, I got a list of questions via email and I need to provide answers to them. But because I`ve never done this before I feel a bit insecure…
So maybe somebody would like to help?

  1. Please follow the plunker link and provide a written code review for the sample code Plunker - Code Review Test

My thoughts about this question:
Get rid of line 13, 14 & 15

I`ve never done code review before.

If you get rid of those lines, the function won’t function anymore, since those insert the text into the DOM. But think about what happens when this function runs, step by step, in each iteration of the loop. What’s the final outcome, and does it make sense to overwrite the h1 in every step?

Also, you can select the h1 directly, there’s no obvious reason why they chain $('body').find('h1'), especially since they’ve given the h1 an id.

I’m not sure if it would be a good idea to give you a full review of the code, because once you get the job based on that, it’ll show immediately that you don’t have the experience that you pretended to have.

But I’ll give some hints for googling:

  • JavaScript naming conventions for functions and variables
  • variables need to be initialised with either the var keyword (or, better) let or const
  • what’s the point in having two variables for the strings myStr and first_part
  • hardcoding the length of the loop makes the function unflexible
  • re-initialising the array (with the terrible variable name x) in each iteration makes little sense
  • do all of the console.logs give valuable insights in the flow of the program

Thaks a lot!
I didn`t know where to start…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.