Completed My First Mini Project !!!

 Hi friends

I am really feeling great after completing my first mini project.

what was it? It was a simple form validation project. And I got to learn many new methods while doing this project. Shared in the post later.

and as I promised I will be sharing even the tiniest details I learnt while doing the project so here is this blog post that I have written to show what stuff ( concept, js methods etc) I learnt while doing the projects.


(note: you may encounter some typos in this post as I am not using any tool like Grammarly)


what I learnt

trim() - removes whitespaces

forEach()


 what is forEach method

forEach method contains a method as an argument . We basically give a function as an input and it calls the function for each array element.

forEach(function())

{

 your executable code


}

2)!== operator

3) slice method ( explained in detail below)



How to make the first character of  a string capitalised and concatenate the remaining string as it is.


for this purpose I used three methods

element.charAt(0).toUppercase + slice[1]


What this function do?

so let us suppose I want to make P in prashant capitalised . So using toUpperCase() will make the whole string capitalised. So we will first use charAt(0) method to make only the first char capital and then we will concatenate the string to it. 

So

prashant.charAt(0).ToUppercase will return PRASHANT

so we will use "+" and slice method to get an array that only gives us a new string with the index no we pass in the array

confused??

prashant.slice[1]  ---> this will give us "rashant"    . this function starts from the index pos we specify and goes to the end. and return us a new string.

note:

slice can also take two arguments 

slice (0,5)

prashant.slice(1,5)

what will this return?

it will start from the first index and traverse till 5-1=4th index. Yes it takes into consideration (second parameter index pos-1) 

so what will the above method return us?

rash is the answer

Comments

Popular posts from this blog

Done with my second mini project !