When you write your code, you may feel that there was a better way of doing this. So let me show you some interesting tricks you might use in your code and make your code shorter and more straightforward.
We are going to understand the fundamentals of these tricks and their use case. Let me start with a simple one that you probably know. Or not.
Lots of array operations require the swapping of elements, for example, sorting. You would need to write a small utility function…
The code sample above will…
Learning web/mobile development from scratch is very important. Getting your basics right about any kind of development is like putting the best foot forward. The best way to do this is through loads of practice such as building multiple projects with different scenarios. I highly recommend building a few small projects before building a comprehensive one, something that you can showcase in your profile.
Let’s start by understanding the list of skills you are required to practice.
I generally recommend…
It's human nature to focus on strength first. As a programmer, it’s natural to consider the programming strength when it comes to considering it as a career goal. I personally believe that your weaknesses are the biggest roadblock to your success. It has a huge impact when you attend a technical interview where some of the weaknesses start coming to the forefront. This also applies in your daily professional deliverables. I am sure most of us have experienced this at some point in our career where we either missed an important deadline or failed an interview. We are all humans…
Strings are primitive data type. Primitive doesn’t mean old, it just means they are as simple as old.
There are three ways to define strings and all of them are perfectly valid. You can either use single quotes, double-quotes, or backticks. Surprisingly, String is the only data type that uses quotes to define a value.
let myDogsname = "cujo";
let myFishsName = 'nemo';
let myPigsName = `babe`;
Let’s focus on let and const.
//example showing the let keyword
let myDogsName = "cujo";
//example showing the const keyword
const myDogsName = "cujo";
The main difference between let and const keywords is that…
let myPetName = 'cujo';
P.S. I don’t really have a dog. So, excuse me if the name doesn’t really gel well with the real time pet names :)
Let’s look at the four parts of the syntax:
There are many different ways you can define a variable. I’ve simplified three rules to begin with:
Reversing a string in any programming language is a very common interview question. There are multiple solutions to this problem. In my opinion, you should answer based on the personality of the interviewer. When interviewer asks you this type of question, they want you to code your solution without using too many built-in functions. Regardless, a one line solution is if you use ES2015 syntax. Let’s start with some built-in functions.
The three solutions to answer this question are :
const s = 'TechSith';const result = s.split('').reverse().join('');console.log(result); // 'htiShceT'
Spread operator is one of the coolest features introduced as part of the ES2015 release, we will look at some its useful applications.