JS, CSS, HTML Interview Questions Flashcards
What is JavaScript?
JS is a client-side(front-end) and server-side(back-end) scripting language
JS is an OOP language
Enumerate the differences between Java and JavaScript
As far as I know Java is to JavaScript as pool is to pool table
What are the JS data-types?
object number string boolean null undefined symbol
What is the use of the NaN function?
Checks to see if a something is a number and returns a boolean value
Which is faster, JS or an ASP script?
JS will be faster if you compare its client-side aspect to the ASP since it is server-side and will run slower
What is negative infinity?
the largest negative number possible
it can be derived by dividing any negative number by 0
Is it possible to break JS code into several lines?
Yes you can use an \n at the end of a line to create a break
Which company developed JS?
Netscape by Brendan Eich
What are undeclared and undefined variables?
Undeclared: undeclared variables are those that do not exist in the code
Undefined: variables that have been declared but not given a value yet
What are global variables? How are these variables declared?
Global variables are declared with the var keyword and are accessible anywhere in the code
meaning they are without scope.
What is a prompt box?
A prompt box is a box that allows the user to enter input by providing a text box
A label and box will be provided to enter data into
What is the ‘this’ keyword in JS?
“this” refers to the object from where it was called
What is the working of timers in JS?
Timers are used to execute a specific piece of code at a set time or to repeat on a specific interval
Which symbol is used for comments in JavaScript?
/* for multi-line comments */
// for single line comments
What is the difference between ViewState and SessionState?
‘ViewState’ is specific to a page in session
SessionState is specific to user-specific data that can be accessed across all web application pages
What is the === operator?
Strictly equals and it looks at whether two pieces of data are identical in type and value
How can you submit a form in JS?
document.form[0].submit()
Does JS support automatic type conversion?
yes, JS does support automatic type conversion
truthy and falsy values are good examples of this in practice
How can the style/class of an element be changed?
get the element from the DOM and either change the style property or change the className property
How to read and write a file using JS?
Using JS extensions
Using a web page and Active X objects
What are all the looping structures in JS?
For loop
while loop
for in loop
Do while loops
What is Variable typing in JS?
it means JS will figure out what type of data you have and make the necessary adjustments so you don’t have to redefine your different types of data
It does this through type conversion
How can you convert the string of any base to an integer in JS?
The parseInt() function is used to convert numbers between different bases.
What is the difference between == and ===?
== is not strict equality and so it allows for type conversion to take place unlike string equality with ===
== only checks for value === checks value and data type