본문 바로가기

Web Programming

JavaScript Syntax(1)

- JavaScript unlike HTML, CSS is a programming language that enhances functionality and appearances of Web pages.

- JavaScript is the standard of client-side scripting languages and makes web pages more dynamic and interactive.

 

- Like CSS, programmers could write JS code inside the HTML file withing the <script> </script> tag, or create a separate js file and link it.

- We should use the second method, because programmer should always separate content, presenation, and behavior.

 

 

- JavaScript is case sensitive.

- JavaScript statements could be split over many lines.

 

- document.write() is used to insert or modify content and style within the document.

 

 

- window.alert() is used to display information in windows that pop up.

- window.prompt() is used to display a window that gets information from the user.

- console.log() is used to debug instead of window.alert().

 

 

 

- When we define variables, we use 'let' keyword.

- 'var' keyword in an older convention.

- While 'let' supports block scope, 'var' does not.

- To declare a constant, we use 'const' keyword.

 

- In JavaScript, types are not specified, but there exsits types which is called 'loosely-typed'.

- Existing types are Number, Boolean, String, Array, Object, Function, null, undefined.

- 'undefined' is a type that a variable has been decalred but has not yet been assigned a value.

- 'null' means a empty value that was specifically assigned.

- Since JavaScript is a loosely typed langauge, it automatically converts the value of a variable when operation is held between values of differnet types.

- Also, comparing data of different types may give unexpected results. One rule of thumb is that when comparing string with a number, JS will convert the string to a number.

Operation in JavaScript could lead to unexpected results

- Control structures such as Selection structures, Repetition structures are all similar with other programming languages such as Python, C++, Java.

'Web Programming' 카테고리의 다른 글

HTML Document Object Model(DOM) & JavaScript Events  (0) 2021.04.13
JavaScript Syntax(2)  (0) 2021.03.30
CSS Syntax(2)  (0) 2021.03.21
CSS Syntax(1)  (0) 2021.03.20
HTML Syntax(2)  (0) 2021.03.15