My First Assessment Test and I Banged It
Tags: react, javascript, discuss
Published: 2020-10-13 00:07:06

I finally gathered enough courage to click the link in my email. It had come about a week ago and I knew I was unprepared for it. It was a link to a [HakerRank](https://www.hackerrank.com/) assessment test from Chili Piper. I had applied for a Front-End developer role. My data structure and algorithm skills were poor, yet I summoned the strength to put myself out there, I mean how bad could it be (_unbelievably bad actually_).

I read the instructions and saw there were just 2 questions to be done in 70 minutes, one React (Front-end), the other code (DSA). I said to myself _"Of course I'll do the react question first!"_ since I had little or no experience in writing data structures and algorithms. To me the only data structure that existed was the `Array`. 

I started the test and decided to go through the questions as one would do in a regular examination. The react question was quite straight forward. I was to complete a form that accepted name, email, phone number and blog URL. I was told to validate the fields using certain criteria and display "Form is Complete!" if all fields were valid and "Form is Incomplete!" if they weren't. Simple right? I decided to check out the DSA question, just to see if I may have been lucky enough to get an easy HakerRank question, **of course I wasn't**. The DSA question was titled "Airport Limousine" or something like that, bottom line, I had no idea what they asked me to do, so back to the react question, I guess. I'm quite experienced in React but I still felt the pressure, like I was drowning in the fear of failure or not being good enough.

Now this is the funny part. I managed to validate all fields successfully except the phone number field. I had about 30 minutes left, I thought to myself _"I can definitely find a regex to validate this in 30 minutes"_. I was supposed to make sure that the phone number was 10 digits and that it didn't start with 0 or 1. I was able to complete the former. Here I was searching every possible site for a regex to check if the first digit of a phone number was 0 or 1, I had never seen 30 minutes fly so fast. I was so disappointed. I had come to the end of my very first assessment test ever and I failed to finish. My roommate walked up to me and asks what's up. I narrate my entire story to him and then he made a statement that'll change my life forever. He asked why I was trying use a regex to validate it when I could have just accessed the number like a string and used the indexing property to do the check. My heart dropped instantly. Basically, rather than looking for a regex is should have done something like:

```
var phoneNumber = 9237463281;

var phoneNumberString = phoneNumber.toString();

if(phoneNumberString [0] === 1 || phoneNumberString [0] === 0) 
    return false;
```

I wasted 30 valuable minutes looking for a complicated answer to a simple question. I guess that's what fear does to us, it blinds us from the most obvious answers to our problems. When we're afraid all we see is how hard the problem is, but not how easy the solution could be. I vowed that never would I allow fear to rule me again.