Javascript Test
A form contains two fields named id1 and id2. How can you copy the value of the id2 field to id1?
An HTML form contains 10 checkboxes all named "chkItems". Which JavaScript function can be used for checking all the checkboxes together?
An image tag is defined as follows: <img id="ERImage" width="100" height="100" onmouseover="ImageChange()" src="Image1.jpg"> The purpose of the ImageChange() function is to change the image sour...
An image tag is defined as follows: <img id="ERImage" width="100" height="100" onmouseover="ImageChange()" src="Image1.jpg"> The purpose of the ImageChange() function is to change the image source...
Analyze the following code snippet which uses a Javascript Regular Expression character set. What will be the output of this code? <html> <body> <script type="text/javascript"> var str = "Is ...
Are the two statements below interchangeable? object.property object[''property'']
Consider the following image definition: <img id="logo" src="companylogo1.gif" height="12" width="12" > Which of the following will change the image to "companylogo2.gif" when the page loads?
Consider the following image definition: <img id="logo" src="companylogo1.gif" height="12" width="12" > Which of the following will change the image to companylogo2.gif when the page loads?
Consider the following JavaScript alert: <script type="text/JavaScript"> function message() { alert("Welcome to ExpertRating!!!") } </script> Which of the following will run the function when...
Consider the following JavaScript alert: <script type="text/JavaScript"> function message() { alert("Welcome to ExpertRating!!!") } </script> Which of the following will run the function when a...
Consider the following JavaScript validation function: <script type="text/JavaScript"> function ValidateField() { if(document.forms[0].txtId.value =="") {return false;} ...
Consider the following JavaScript validation function: function ValidateField() { if(document.forms[0].txtId.value =="") {return false;} return true; } Which of the...
Consider the following variable declarations: var a="adam" var b="eve" Which of the following would return the sentence "adam and eve"?
Consider the three variables: someText = 'JavaScript1.2'; pattern = /(w+)(d).(d)/i; outCome = pattern.exec(someText); What does outCome[0] contain?
Having an array object var arr = new Array(), what is the best way to add a new item to the end of an array?
How can a JavaScript object be printed?
How can created cookies be deleted using JavaScript?
How can global variables be declared in JavaScript?
How can the operating system of the client machine be detected?
How can the user's previously navigated page be determined using JavaScript?
If an image is placed styled with z-index=-1 and a text paragraph is overlapped with it, which one will be displayed on top?
In an HTML page, the form tag is defined as follows: <form onsubmit="return Validate()" action="http://www.mysite.com/"> The validate() function is intended to prevent the form from being submitted...
Performance-wise, which is the fastest way of repeating a string in JavaScript?
Select the following function that shuffles an array?
The following are the samples for getting a selected value in the from a dropdown list: <select id="ddlViewBy"> <option value="1">test1</option> <option value="2" selected="selected">test2</option...
var profits=2489.8237 Which of the following code(s) produces the following output? output : 2489.824
What does the following JavaScript code do? contains(a, obj) { for (var i = 0; i < a.length; i++) { if (a[i] === obj) { return true; } } return false; }
What is the difference between call() and apply()?
What is the error in the statement: var charConvert = toCharCode('x');?
What is the final value of the variable bar in the following code? var foo = 9; bar = 5; (function() { var foo = 2; bar= 1; }()) bar = bar + foo;
What is the meaning of obfuscation in JavaScript?
What is the purpose of while(1) in the following JSON response? while(1);[['u',[['smsSentFlag','false'],['hideInvitations','false'],['remindOnRespondedEventsOnly','true'],['hideInvitations_remindO...
What value would JavaScript assign to an uninitialized variable?
What will be output of the following code? function testGenerator() { yield "first"; document.write("step1"); yield "second"; document.write("step2"); yield "third"; docu...
What will be the final value of the variable "apt"? var apt=2; apt=apt<<2;
What would be the use of the following code? function validate(field) { var valid=''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz''; var ok=''yes''; var temp; for(var i=0;i...
What would be the value of 'ind' after execution of the following code? var msg="Welcome to ExpertRating" var ind= msg.substr(3, 3)
When setting cookies with JavaScript, what will happen to the cookies.txt data if the file exceeds the maximum size?
Which event can be used to validate the value in a field as soon as the user moves out of the field by pressing the tab key?
Which object can be used to ascertain the protocol of the current URL?
Which of following uses the "with" statement in JavaScript correctly?
Which of the following are correct values of variableC, and why? <script> variableA = [6,8]; variableB =[7,9]; variableC = variableA + variableB; </script>
Which of the following are JavaScript unit testing tools?
Which of the following are not global methods and properties in E4X?
Which of the following Array methods in JavaScript runs a function on every item in the Array and collects the result from previous calls, but in reverse?
Which of the following best describes a "for" loop?
Which of the following built-in functions is used to access form elements using their IDs?
Which of the following can be used for disabling the right click event in Internet Explorer?
Which of the following can be used to escape the ' character?
Which of the following can be used to invoke an iframe from a parent page?
Which of the following choices will change the source of the image to "image2.gif" when a user clicks on the image?
Which of the following choices will detect if "variableName" declares a function? <script> var variableName= function(){}; </script>
Which of the following choices will turn a string into a JavaScript function call (case with objects) of the following code snippet? <script> window.foo = { bar: { baz: function() { ...
Which of the following code snippets changes an image on the page?
Which of the following code snippets gets an image's dimensions (height & width) correctly?
Which of the following code snippets is more efficient, and why? <script language="JavaScript"> for(i=0;i<document.images.length;i++) document.images[i].src="blank.gif"; </...
Which of the following code snippets removes objects from an associative array?
Which of the following code snippets returns "[object object]"?
Which of the following code snippets trims whitespace from the beginning and end of the given string str?
Which of the following code snippets will correctly get the length of an object?
Which of the following code snippets will correctly split "str"?
Which of the following code snippets will return all HTTP headers?
Which of the following code snippets will toggle a div element's background color? <button id="toggle">Toggle</button> <div id="terd">Change Background Color.</div>
Which of the following correctly sets a class for an element?
Which of the following correctly uses a timer with a function named rearrange()?
Which of the following descriptions best describes the code below? <script> var variable1 = { fastFood: "spaghetti", length: 10 }; Object.freeze(variable1); variable1.price = 50; delete variable1....
Which of the following descriptions is true for the code below? var object0 = {}; Object.defineProperty(object0, "prop0", { value : 1, enumerable:false, configurable : true }); Object.defineProper...
Which of the following determines whether cookies are enabled in a browser or not?
Which of the following is not a valid HTML event?
Which of the following is not a valid JavaScript operator?
Which of the following is not a valid method for looping an array?
Which of the following is not a valid method in generator-iterator objects in JavaScript?
Which of the following is the correct syntax for using the JavaScript exec() object method?
Which of the following is the most secure and efficient way of declaring an array?
Which of the following is true about setTimeOut()?
Which of the following JavaScript Regular Expression modifiers finds one or more occurrences of a specific character in a string?
Which of the following methods will copy data to the Clipboard?
Which of the following modifiers must be set if the JavaScript lastIndex object property was used during pattern matching?
Which of the following objects in JavaScript contains the collection called "plugins"?
Which of the following options can be used for adding direct support for XML to JavaScript?
Which of the following prints "AbBc"?
Which of the following Regular Expression pattern flags is not valid?
Which of the following results is returned by the JavaScript operator "typeof" for the keyword "null"?
Which of the following statements is correct?
Which of the following will change the color of a paragraph's text to blue when a user hovers over it, and reset it back to black when the user hovers out?
Which of the following will check whether the variable vRast exists or not?
Which of the following will detect which DOM element has the focus?
Which of the following will randomly choose an element from an array named myStuff, given that the number of elements changes dynamically?