You are able to see lots of ( ) in JavsScript code,
and there is curiosity that what are they doing for?
In Function it's used for excuting the function code.
If you read my JavaScript-basic blog there is example of how to use the function and you don't want
to reapeat this function code at all the time just simply you can call yourfunction with ().
You also use ( ) for the condititonal statement and the looping
statement.
In this time you add content in the ( ), for example if you want
to give a condtion, you write down
your condition inside of ( ) after if.
We are using the bracktets for array, what is array? Array is the list basket if I say simly explaining. For examply, I need list for my favorite movie then I could make movieList = ['Harry Potter', 'Inception', 'Iron man-1']. Also if you want to select one movie from my list, using [ ]. Wait, How? Array has a index property, so my movie list has a index number each 'Harry Potter' has index 0, 'Inception' has index 1 and 'Ironman-1' has index 2. Yes, it starts from 0, please don't confuse with the length. So we could select 'Harry Potter' with movieList[0]
We are using brace for Object and enclose blocks of code(function,loop,condition etc), I am talking about the object mainly because it's very important to use the object in JavsScript. When I mentioned about my movieList there is characters in the movie, right? So I want to make a list each my favorite movie this time I am using { }. chracterList = {"Harry Potter":{"Name":"Harry Potter", "Role":"Main Character", "Actor":"Daniel Radcliffe"}, "Iron man-1":{"Name":"Tony Stark", "Role":"Main Character", "Actor":"Robert Downey, Jr."}} like this. Yes, You can add object in object even you can add array in object, very cool and confusing haha! How can you select 'Actor's name? It's simply we are using [ ] and dot. So We could select chracterList["Harry Potter"].Actor or you can use [Actor] as well.
We use the single quotes for stiring(text), you see the above I wrote the Harry Potter with ' ' in array list. Also you can see I used " " as well, you are able to use both for string. But how about you want to change your text in a new line also js.file read your ' ' as a code but you only use for like [he's]. That time we use ' ', for example 'A string that\'s single quoted' slash is saying to our computer "hey this single quote is not for string another string".
Next blog page