JavaScript and Learning to Program (Week 8/9) Flashcards
What is JavaScript?
A rather simple high-level programming language
What is JavaScript’s Purpose?
The purpose of JavaScript is to allow web browsers to achieve dynamic effects on web pages
Where is JavaScript usually run?
JavaScript usually runs on top of a website (Hypertext Markup Language Document - HTML) inside a web browser
What is Computational Thinking?
how to formulate a solution to a problem so that a machine can execute it.
What does HTML stand for?
Hypertext Markup Language
What is a Tag in HTML?
Tags are commonly defined as a set of characters constituting a formatted command that will display or function on a web page.
Where is JavaScript embedded in HTML code?
In between < script> … </script > tags.
What is HTML?
HTML is not programming but rather a set of markup symbols or codes inserted into a file intended for display on the Internet.
The markup tells web browsers how to display a web page’s words and images.
Do note, like JavaScript, not all browsers show the HTML the same way. There are subtle (and not so subtle) differences in function and look.
Is JavaScript compiled?
JavaScript is not compiled, but interpreted => we can see the code when we look at the web page source
(e.g. right click => “View Page Source” or CTRL-U in Chrome)
What does it mean that JavaScript is an Interpreted Language?
It does not need a compiler to run.
The interpreter is in the browser and it reads over the JavaScript code, interprets each line, and runs it.
What are some advantages of JavaScript?
JavaScript is in widespread use
* In almost any web-browser, regardless of the operating system
Easy to write and test – rather simple language and no need for compilers and other specialized software
* Besides the browser, a text editor is all you would need
* Many tools allow you to work even without text editor
Most web pages contain JavaScript
* It is easy to get inspiration (and copy code) from other pages
What are some disadvantages of JavaScript?
Slightly different implementation with different browsers
* What runs on Chrome, might not run properly on Edge
* This keeps getting better with newer versions
Runs only as a part of a web page
* “standalone” programs are typically not made with JavaScript
* Programs are not compiled to machine code => slower execution
We need to learn basics of the Hypertext Markup Language (HTML) to run our JavaScript examples inside a web page
* JavaScript is usually embedded in HTML code in between
< script>…</script > tags
What is another name for a JavaScript program?
A JavaScript program is also called a script
=> the text in between < script>…</script > tags
What are some basic properties of JavaScripts?
Usually, every line contains one instruction (also called statement); instructions are executed one by one starting at the top
Most statements (and thus most lines) end with a semicolon ;
Lots of JavaScript libraries (collections of re-usable scripts) are built-in and provide features for us to reuse in our programs,
e.g. alert() to display a short message in a message box
Determine the effect(s) of the following JavaScript Code :
1 <script> 2 alert("Hello World!"); 3 <script>
Result :
Nothing, there is no “</script>” to finish the code