niedziela, 10 maja 2015

Write code every day ... and rest before ... test

Recently I have got almost three weeks in work without writing code.. I prepare documentations, meeting with clients, coordinating projects... even at home I often was too tired to practice writing code. During these weeks I have got online live test for some company, I fail this test on start because of my attitude, I was tired because 5 min before the test I come back to home with my family I was nervous that I was late and I presupposed that I will fail this test...

And yes I failed this test... What lessons I learned form this...? There are few things:

  • I need a rest before test,
  • Try to be optimist not pessimist,
  • The most important thing is that I need practice writing code, just like John Resig writes in his blog post "Write Code Every Day".., I just can't have so many days without writing code....

Oh  and here is the test question I have got (yes I know it is simple):

Implement function check(text) which checks whether brackets within text are correctly nested.  You need to consider brackets of three kinds: (). {}, {}.

console.log( check("a(b)") );// = > true
console.log( check("[{}]") );// = >true
console.log( check("[(]") );// = > false
console.log( check("}{") );// => false
console.log( check("z([{}-()]{a})"));// => true
console.log( check("") );// = >true

And below I put my answer from today, when I just sit to this task relaxed...