Skip to main content

Posts

Showing posts with the label Asynchronous JavaScript and XML

What Is Difference Between Undefined and Object?

JavaScript Undefined vs Object -  Undefined – The undefined means some variable is declared but the value of variable is not defined yet. Object - Object means some variable is declared but the value of variable is not defined that is either function, object OR array. You can easily be understanding in the below example in detail – let emp ; //The declaration of emp is hoisted but the value of emp is  undefined. console . log ( emp ); //The output is undefined console . log ( typeof ( null ));      // object console . log ( typeof ( undefined )); // undefined ü   Stayed Informed –   Object Oriented JavaScript Interview Questions I hope you are enjoying with this post! Please share with you friends!! Thank you!!!

How To Create the Namespace in JavaScript?

Create the Namespace in JavaScript- You can see the below example in Detail- //AJAX Synchronous and Asynchronous Requests. //#REGION NAMESPACE var demo = demo || {}; //#ENDREGION demo . ajax = demo . ajax || ( function () {     var getBaseURL = function () {         var currentBaseURL = location . protocol + "//" + location . hostname +             ( location . port && ":" + location . port ) + "/" ;         return currentBaseURL ;     };     var baseURL = getBaseURL ();     var request_token ;     var ajaxAsyncCall = function ( requestURL , typeGP , inputs , request_token ) {         //Ajax Async CALL         $ . ajax ({    ...

"1"+2+3 = ? And 1+2+"3" = ? OutPut Will Be?

What will be the output of the above line of code? Answers:- As you know in JavaScript, when the “first character” is a “string” the remaining characters will be converted into a “single string” that means the output of “1”+2+3 will be 123. If the “string” is at the end the initial characters will perform normal mathematical functions before converting into a “string”, that means the output of 1+2+“3” will be 33. Stayed Informed – Best JavaScript Interview Questions & Answers I hope you are enjoying with this post! Please share with you friends. Thank you!!

What is the difference between the function declarations below?

What is the difference between the function declarations below? var user = function () { //TODO: Some code }; And function country() { //TODO: Some code }; Answers :- The main difference is the function user is defined at run-time whereas function country is defined at parse time. For example as, < script type = "text/javascript" > //WHEN WE CALLING USER FUNCTION HERE WILL THROW AN ERROR. user(); var user = function (){ alert( "Hello, I am a user!" ); }; < /script> < script type = "text/javascript" > //WHEN WE CALLING USER FUNCTION HERE WILL NOT THROW AN ERROR. country(); function country(){ alert( "Hello, I am a country!" ); }; < /script> Stayed Informed – Best JavaScript Interview Questions & Answers I hope you are enjoying with this post! Please share with you friends. Thank you!!

What is AJAX (Asynchronous JavaScript and XML)?

What is AJAX? The AJAX stands for “ Asynchronous JavaScript and XML ” and AJAX is a technique to creating interactive web applications and allows us to send and receive data asynchronously without refreshing the web page. The XMLHttpRequest object is part of a technology called AJAX . AJAX is very faster and easy, we can implement AJAX in a meaningful manner. It is a group of related technologies looks like, a)       HTML/XHTML and CSS b)      DOM c)       XML or JSON d)      XMLHttpRequest e)       JavaScript The AJAX was popular in 2005 by Google , with Google Suggest . Where it is used? The AJAX technology used by a)       Google, b)      Facebook, c)       Twitter etc. I hope it is helpful to you! Thank you!

Object in JavaScript - Object Creation by Constructor, Function and Prototype

How to create a JavaScript object? The JavaScript object  is a collection of properties and the each property associated with the name-value pairs . The object can contain any data types (numbers, arrays, object etc.) The example looks like, Var myObject= {empId : “001”, empCode :”X0091”}; In the above example, here are two properties one is empId and other is empCode and its values are “001” and “X0091”. The properties name can be string or number. If a property name is number i.e. Var numObject= {1 : “001”, 2 :”X0091”}; Console.log(numObject.1);   //This line throw an error! Console.log(numObject[“1”]);   // will access to this line not get any error! As per my thought, the number property name should be avoided. Types of creating an object ( There are two types ) 1.       Object literals 2.       Object constructor Object Literals : This is the most common way to ...