Monday, January 3, 2022

Js tutorial - part 1 - variables

okay, so we ended HTML tutorial ( i hope, if you didnt, you can always look it up at https://hacknorris.blogspot.com/search/label/HTML =]

differences between '=' chars:

= is... just is. mostly used in defining variable or assigning data to or from external api's

== is equal to. same as 'normal' = in maths

=== is strict equal. cant be provided with numbers after commas and so on. rarely used

-----

firstly - defining varibles using var keyword:

var x = y

saves variable with setted data

var Variable

saves variable without data. for example to set it up later. eg. from user input.

-----

secondly - defining variables using let keyword:

let x = y

! important - you cant change value if you use let !

(but you can set other value if outside same block)

(not possible to make it empty like in var)

-----

thirdly - defining variables using const keyword:

const x = y 

! important you cant either set other value in block and outside !

(not possible to make it empty like var)

-----

(just hoping its correct and readable :'D )



No comments:

Post a Comment