• Interview Question Answers for Freshers and Experienced

    Latest Google,SEO,PPC,SEM,SMO,Wordpress,Joomla,CMS,Analaytic,Webmaster,Adwords News Information Algorithm Updates,Free Paid Tools,Plugin,Tutorial,Jobs, Solutions,Upcoming Online basic advanced Interview question answers for freshers experienced.

  • High PR Social Bookmarking Sites

    Looking for Free High PR Dofollow social bookmarking sites.Here you found all free high PR social bookmarking sites that can boost your firm's business profits easily.

  • High PR Video Promotion or Submission Sites

    Looking for Free High PR Video Promotion or Submission Sites.Here you found all free High PR Video Promotion or Submission Sites that can boost your firm's business profits easily.

Showing posts with label Top 20 JavaScript Interview Questions. Show all posts
Showing posts with label Top 20 JavaScript Interview Questions. Show all posts

Wednesday, August 19, 2015

Javascript Interview Questions and Answers for Experienced basic advanced 2015-2016

Javascript Interview Questions and Answers for Experienced basic advanced 2015-2016,JavaScript Interview Questions and Answers 2015,Top 20 JavaScript Interview Questions,JavaScript Interview Questions & Answers,JavaScript Interview Questions and Answers For Freshers and Experienced, JavaScript Frequently Asked Interview Questions,Freshers Latest JavaScript Technical Interview Questions & Answers,F2F Interview,JavaScript, Interview Questions & Answers,What would be some common JavaScript interview questions,JavaScript interview questions and answers for 2 years,JavaScript Developer Interview Questions,10 Common face to face JavaScript interview questions and answers,JavaScript Interview Questions and Answers,Top 10 JavaScript Interview Questions and Answers 2015,JavaScript (CMS)Interview Question Answer,Technical JavaScript Interview Questions and Answers for getting Job,Where can I find good JavaScript interview questions,JavaScript job interview questions and answers for freshers,JavaScript interview questions and answers for experienced,10 Tough JavaScript Interview Questions With Smart Answers,JavaScript interview questions and answers for experienced,How to Answer JavaScript Interview Questions,Where can I find good JavaScript interview questions ,Download JavaScript Interview Questions.

Queston: How to convert a string to lowercase?

var str='This is testing String';
str = str.toLowerCase();
console.log(str);



Question: How to modify the URL without reloading the page?

use pushState javascript function. 
For Example:
window.history.pushState('page2', 'This is page Title', '/newpage.php');


Question: How to set a default parameter value for a JavaScript function?

/** Here email is parameter in which we have set the default value i.e email@domain.com **/
function function1(name, email)
 {
   email = typeof email !== 'undefined' ? email : 'defaultemail@domain.com';
    console.log('name='+name+', Email= '+email);
 }

function1('john','xyz@gmail.com');
function1('john');

Question: How to convert JSON String to Object?

var jsonData = '{"name":"27seos","year":2015}';
var myobject = JSON.parse(jsonData);
console.log(myobject);

Question: How to convert Object to String?

var myobject=['27','seos','Notes']
JSON.stringify(myobject);


Question: How to check an variable is Object OR String OR array?

Use below function to get Data type of javascript variable.
function checkDataType(someVar){
 result ='String';
    if(someVar instanceof Object){
       result ='Object'
    }
    if($.isArray(someVar)){
      result = 'Array';
    }
return result;
}

var someVar= new Array("Raab", "Volvo", "Audi");
console.log(result);



Question: Can i declare a variable as CONSTANT like in PHP?

No, I think cosntant not exist in javascript. 
But you can follow same type convention to declare constant.
var CONSTANT_NAME = "constant value";


Question: How to open URL in new tab in javascript?

use javascript, window.open function.
window.open('http://www.xyz.in/','_blank');


Question: What is difference between undefined and object?

undefined means some variable's value is not defined yet.
object means variables's value is defined that is either function, object OR array.

With use of below, you can easily determine whether it is object OR NULL.
console.log(typeof(null));      // object
console.log(typeof(undefined)); // undefined


Question: How to get current date in JavaScript?

var today = new Date();
console.log(today);

Question: What is the best way to detect a mobile device in jQuery?
 
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {

}

Question: How do I declare a namespace in JavaScript?

var myNamespace = {

    function1: function() {   },

    function2: function() {    }

    function3: function() {    }
};

myNamespace.function3();


Question: How to detect mobiles including ipad using navigator.useragent in javascript?

 if(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) ||  navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/iPhone/i)){
        console.log('Calling from Mobile');      
    }else{
    console.log('Calling from Web');      
}



Question: How to detect mobiles including ipad using navigator.useragent in javascript?

 if(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) ||  navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/iPhone/i)){
        console.log('Calling from Mobile');      
    }else{
    console.log('Calling from Web');      
}

Thursday, August 6, 2015

JavaScript Interview Questions and Answers 2015

JavaScript Interview Questions and Answers 2015,Top 20 JavaScript Interview Questions,JavaScript Interview Questions & Answers,JavaScript Interview Questions and Answers For Freshers and Experienced. JavaScript Frequently Asked Interview Questions,Freshers Latest JavaScript Technical Interview Questions & Answers,F2F Interview,JavaScript, Interview Questions & Answers,What would be some common JavaScript interview questions,JavaScript interview questions and answers for 2 years,JavaScript Developer Interview Questions,10 Common face to face JavaScript interview questions and answers,JavaScript Interview Questions and Answers,Top 10 JavaScript Interview Questions and Answers 2015,JavaScript (CMS)Interview Question Answer,Technical JavaScript Interview Questions and Answers for getting Job,Where can I find good JavaScript interview questions,JavaScript job interview questions and answers for freshers,JavaScript interview questions and answers for experienced,10 Tough JavaScript Interview Questions With Smart Answers,JavaScript interview questions and answers for experienced,How to Answer JavaScript Interview Questions,Where can I find good JavaScript interview questions ,Download JavaScript Interview Questions.

1) What is JavaScript?

JavaScript is a scripting language. It is different from Java language. It is object-based, lightweight and cross platform. It is widely used for client side validation.

2) What is the difference between JavaScript and jscript?

Netscape provided the JavaScript language. Microsoft changed the name and called it JScript to avoid the trademark issue.In other words, you can say JScript is same as JavaScript, but it is provided by Microsoft.

3) How to write a hello world example of JavaScript?

A simple example of JavaScript hello world is given below. You need to place it inside the body tag of html.

<script type="text/javascript">
document.write("JavaScript Hello World!");
</script>

4) How to use external JavaScript file?

I am assuming that js file name is message.js, place the following script tag inside the head tag.

<script type="text/javascript" src="message.js"></script>

5) Is JavaScript case sensitive language?

Yes.

6) What is BOM?

BOM stands for Browser Object Model. It provides interaction with the browser. The default object of browser is window.

Browser Object Model

7) What is DOM? What is the use of document object?

DOM stands for Document Object Model. A document object represent the html document. It can be used to access and change the content of html.

Document Object Model

8) What is the use of window object?

The window object is automatically created by the browser that represents a window of a browser.

It is used to display the popup dialog box such as alert dialog box, confirm dialog box, input dialog box etc.


9) What is the use of history object?

The history object of browser can be used to switch to history pages such as back and forward from current page or another page. There are three methods of history object.

history.back()
history.forward()
history.go(number): number may be positive for forward, negative for backward.

10) How to write comment in JavaScript?

There are two types of comments in JavaScript.

Single Line Comment: It is represented by // (double forward slash)
Multi Line Comment: It is represented by slash with asterisk symbol as /* write comment here */

11) How to create function in JavaScript?

To create function in JavaScript, follow the following syntax.

function function_name(){
//function body
}

12) What are the JavaScript data types?

There are two types of data types in JavaScript:

Primitive Data Types
Non-primitive Data Types

13) What is the difference between == and ===?

The == operator checks equality only whereas === checks equality and data type i.e. value must be of same type.

14) How to write html code dynamically using JavaScript?

The innerHTML property is used to write the HTML code using JavaScript dynamically. Let's see a simple example:

document.getElementById('mylocation').innerHTML="<h2>This is heading using JavaScript</h2>";  

15) How to write normal text code using JavaScript dynamically?

The innerText property is used to write the simple text using JavaScript dynamically. Let's see a simple example:

document.getElementById('mylocation').innerText="This is text using JavaScript";  

16) How to create objects in JavaScript?

There are 3 ways to create object in JavaScript.

By object literal
By creating instance of Object
By Object Constructor
Let's see a simple code to create object using object literal.

emp={id:102,name:"Rahul Kumar",salary:50000}  

17) How to create array in JavaScript?

There are 3 ways to create array in JavaScript.

By array literal
By creating instance of Array
By using an Array constructor
Let's see a simple code to create array using object literal.

var emp=["Shyam","Vimal","Ratan"];  

18) What does the isNaN() function?

The isNan() function returns true if the variable value is not a number.

19) What is the output of 10+20+"30" in JavaScript?

3030 because 10+20 will be 30. If there is numeric value before and after +, it is treated is binary + (arithmetic operator).

20) What is the output of "10"+20+30 in JavaScript?

102030 because after a string all the + will be treated as string concatenation operator (not binary +).