javascript Flashcards
What is the advantage of external JavaScript?
Separates HTML and Code
Makes HTML and JavaScript easier to read and maintaiin
Cached JS files can speed up page loads
Name the four ways of JavaScript Display Possibilites :
console.log() -browser console
window.alert() -alert box
document.write() -html element
innerHTML
Write the code to change the id element named “demo” when the user clicks on a button.
<p>This will be changed</p>
Click
<h1>My First Web Page</h1>
<p>My First Paragraph.</p>
<p></p>
Insert the sum of 5+5 inside the p tag.
var a =document.getElementById("demo"); a.innerHTML = 5+5;
The JavaScript programs are executed by what?
the web browsers
Can you name the javascript statements?
C : comment O : operators V : values E : expressions K : keywords
What are the two types of JavaScript Values?
Fixed values and variable values.
fixed values : literals
variable values : variables
Name the ways you can declare variables
var, let and const
Difference between let and var?
var : known through out the function it is defined in
let : known thoughout the block it is defined in
Is JavaScript case sensitive?
Yes
What character set does javascript use?
Unicode
How do you debug in javascript?
All moderns browsers have a build in javascript debugger.
F12 and console
Name the 7 Javascript types.
Number String Boolean function Object Null Undefined
How to create a javascript object?
var person ={firstname: “John”,
lastname: “Doe”,
age: 50};
What is the typeof undefined?
undefined
What is the datatype of null?
object
what is null=== undefined?
false
What is null==undefined?
true