Don't write code too short because it's make other developers hard to understand, look at this code below
‘?’ i = i ? i < 0 ? Math.max(0, len + i) : i : 0;
Can you guessed value of variable I? If someone find this code he will spend his entire life just to find that variable i value is 0.
Don't name you variable with a, b, c or d, a short variable name because it's hard to find and search by editor, and even if we already found it we can't understand "the true meaning" of this variable until we analyze the code line by line.
Don't name your variable with a meaningless abbreviation
list → lst begin_date →bgdt browser → bws
dteofbrth you can use
dob as abbreviation of date of birth, it will help a lot in the future.
Don't use abstract name such as
obj, value, data, elem as your variable name unless it's is necessary, it's hard to define
data variable if we use more than one data, and what is
value mean either? everything has data and value
Instead you can use
customerData to define more meaningful variable name
Don't create a function that has many functionality, a good function only do one thing,
validateEmail(email) function should only validate email format not to send or pre-fill email value, you can create other function to do that.
If you define
showFirstName function to preview first name value then don't define
displayLastName as function to preview last name value, it's confusing and hard to debug when our code is getting bigger, be consistent with your prefix
displayLastName you can define your function with
showLastName, be consistent
Don't reuse a variable name that already set, because it's hard to know the actual value when we use it at multiple place