learn coding

Learn coding

[by understanding the logic behind ]


Coding is not so difficult as it sounds , we make things hard for us unintentionally by trying to memorize everything,  however, if we instead try to understand the code and why we use specific code in certain times, this method is the key to be better in coding.

lets take simple JQuery function and examine it :


setInterval (function ( ) ({

someFunction( );

), 1000 }


take a look at this function , you might be familiar with it but if not I will explain it.

This function it will call another function repeatedly in every second (notice : 1000  it means 1000 ms.)

its like loop of function.

now let’s think why and when we need this function ?

I made a course on how to create ajax chat app , you can see the course here , I used this function to call ajax in background. to simplify even farther.

for example I want to see if I have any new messages by making query that will go and fetch the database to see if I have any new message, so I don’t want to refresh the page every second , that would be a disaster ^^,

So I made ajax call in background to communicate with the database for any new message every second , that way the user will not feel anything , and if I got message it will be shown. that way I used ( setInterval function )

there are many cases that we might need this function , for example Slideshow , you will display new photo every specific time , and many cases you will need this function.

Now we understood why we need to use this function same will be for every line of code.

so it’s all about understanding not memorizing , this is how to learn coding in my opinion.

I hope I explained enough , if you have better methods share with us , we always learning that’s the beauty of life.

if you want to learn more about web in general this is the best resource : w3schools