September 25, 2019

Srikaanth

Marketo Latest JavaScript Interview Questions Answers

What is an ECMAScript?

ECMAScript (European Computer Manufacturers Association) Script is a specification for the scripting language standards. It has standardized Javascript which made Javascript the best implementation of ECMAScript.

Are Attributes and Property the same?

No. Attributes are something that can give more details on an element like id, type, value etc. Whereas, Property is the value assigned to the property like type="text", value='Name' etc.

List out the different ways an HTML element can be accessed in a Javascript code.

Here are the list of ways an HTML element can be accessed in a Javascript code,

(i) getElementById('idname'): Gets an element by its ID name

(ii) getElementsByClass('classname'): Gets all the elements that have the given classname.

(iii) getElementsByTagName('tagname'): Gets all the elements that have the given tag name.

(iv) querySelector(): This function takes css style selector (like #id/.classname/tagname) and returns the first selected element.

(v) querySelectorAll(): Similar to querySelector, this function returns a NodeList of html elements.

In how many ways a Javascript code can be involved in an HTML file?

The Javascript code can be involved in 3 ways (i) Inline (ii) Internal (iii) External

What are the new ways to define a variable in Javascript?

There are three possible ways of defining a variable in Javascript (i) var (which is used from the beginning) (ii) const (iii) let. The last two ways are the latest ways of defining a variable and are introduced in ES-2015(ES6 version).

What is a function callback?

The callback function is a mechanism to send one function to another function as an argument; i.e., passing func as an argument to another function.

What happens when the recursion calling is applied on two functions?

The calling of recursion is possible in two functions, but the call comes to an end after some time.
Marketo Most Frequently Asked Latest JavaScript Interview Questions Answers
Marketo Most Frequently Asked Latest JavaScript Interview Questions Answers

What will this code print?

It will print 0 1 2 3 4, because we use let instead of var here. The variable i is only seen in the for loop’s block scope.

What do the following lines output, and why?

console.log(1 < 2 < 3);
console.log(3 > 2 > 1);

The first statement returns true which is as expected.

The second returns false because of how the engine works regarding operator associativity for < and >. It compares left to right, so 3 > 2 > 1 JavaScript translates to true > 1. true has value 1, so it then compares 1 > 1, which is false.

Explain the term closure.

The inner functions can be called as closure when it has access to the outer function's variables.

Explain the terms synchronous and asynchronous code.

The synchronous code is something that should be finished before anything else can happen, or in other words, the synchronous code is blocking. And the Asynchronous code is something in which actions can happen and is not dependent on other actions- in other words, it is non-blocking.

Name the different types of pop up boxes in Javascript.

There are three types of pop up boxes in Javascript (i) alert() provides some information to the user with just an OK button (ii) confirm() asks a question to the user with two options Ok and cancel, and (iii) prompt() takes an input from the user.

What is Ajax?

Ajax is abbreviated as Asynchronous Javascript and XML. It is new technique used to create better, faster and more interactive web systems or applications. Ajax uses asynchronous data transfer between the Browser and the web server.

This technique is used to make internet faster and user friendly. It is not a programming language.

What are the disadvantages of Ajax?

Following are the disadvantages of Ajax:

AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS, Ajax will not support
Ajax can be problematic in Search engines as it uses Javascript for most of its parts.
Source code written in AJAX is easily human readable. There will be some security issues in Ajax.
 Debugging is difficult
 Increases size of the requests
 Slow and unreliable network connection.
Problem with browser back button when using AJAX enabled pages.

What is update panel?

Update panel  is a server control used to update the specified portion of a web page. Script Manager needs to be used whenever update panel is used. Using update panel, user cannot handle outside controls.

Which are the two methods used for cross domain Ajax calls?

There are two methods used to transfer data between the two more more security domains:

CORS – Cross Origin Resource Sharing and it works with the HTTP web browsers
JSONP – JSON with Padding which works with the HTTP GET and on legacy browsers

What are all the technologies used by Ajax?

AJAX uses following technologies:

JavaScript
XMLHttpRequest
Document Object Model (DOM)
Extensible HTML (XHTML)
Cascading Style Sheets (CSS)

What are all the features of Ajax?

Following are the features of Ajax and they are as follows:

Live data binding
Client-side template rendering
Declarative instantiation of client components
Observer pattern on JavaScript objects and arrays
Invoking ADO.NET data services and data contexts
DataView control

What are Ajax applications?

Browser based applications and platform independent applications are used by Ajax.

Subscribe to get more Posts :