Q). What is an expression?
A). A regular expression is a sequence of characters that forms a search pattern.When you search for data in a text, you can use this search pattern to describe what you are searching for.
A regular expression can be a single character, or a more complicated pattern. Regular expressions can be used to perform all types of text search and text replace operations.
Q). What is a binding?
A). The âbindâ method in Javascript is used to bind some of the arguments of the function including the âthisâ reference. In other words, bind method allows us to define what objects to bind to when executing method, what will be the execution context for the methods, and what will be the preset value of the function when invoked.
Q).What is an environment?
A). JavaScript typically relies on a run-time environment (e.g., a Web browser) to provide objects and methods by which scripts can interact with the environment (e.g., a webpage DOM ). It also relies on the run-time environment to provide the ability to include/import scripts (e.g., HTML elements).
Q).What is a function?
A). A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses ().
Function names can contain letters, digits, underscores, and dollar signs (same rules as variables).
The parentheses may include parameter names separated by commas:
(parameter1, parameter2, âŠ)
Q).Give an example of a function.
A).Convert Fahrenheit to Celsius: // (https://www.w3schools.com/js/js_functions.asp)
function toCelsius(fahrenheit) {
return (5/9) * (fahrenheit-32);
}
document.getElementById(âdemoâ).innerHTML = toCelsius(77);
Q).What is a side effect?
A). Side effects include, but are not limited to: Making a HTTP request. Mutating data. Printing to a screen or console. DOM Query/Manipulation. Math.random() Getting the current time.
Q).Give an example of a function that produces a side effect and another function that produces a value.
A). // doesnât always return the same value
function counter() {
// globals are bad
return ++x;
}
// omitting calls to say
change logging behavior
function say(x) {
console.log(x);
return x;
}
Q). What is control flow?
A). Control flow testing is a testing technique that comes under white box testing. The aim of this technique is to determine the execution order of statements or instructions of the program through a control structure. The control structure of a program is used to develop a test case for the program.
Q). What is conditional execution?
A). Binary Selection ¶ In order to write useful programs, we almost always need the ability to check conditions and change the behavior of the program accordingly. Selection statements, sometimes also referred to as conditional statements, give us this ability. The simplest form of selection is the if statement .
Q).What kind of keyword do you need to use to invoke conditional execution?
A). IF/ELSE, THEN