DEV Community

SIYUM
SIYUM

Posted on

JS - FAQ

What is javascript.?

JavaScript is scripting language that is usually using to dynamically updating the content.

Explain about the history of JavaScript.

LiveScript(Mocha) is created by Brendan Eich in 10 days, which is later renamed to JavaScript.

Whatis ECMA Script.?

ECMA specification is defining the syntax to how it should work, ensuring consistnce of the script

What are the methods of creating valid identifiers in JS.?

Valid Methods
var firstName;
var _privateVariable;
var $element;
var counter;
var camelCaseVariable;

Invalid methods
var 123abc; // Cannot start with a digit
var my-variable; // Hyphens are not allowed
var if; // Reserved word as an identifier
var first name; // Spaces are not allowed

How JS Works

Image description

What is bigint.?

The numbers greater than 2^53 - 1

What is the difference between null and undefined?

Undefined mean variable declared, but value is not assigned. Null mean there is no value in it(Empty value).

What is a DOM.? Explain.

Document Object Modal. Programming interface for web document. We can use the JS to manupulate this.

Difference of the For In and For Of

{
a : 1,
b : 2
}

For in will return the attributes - {a, b}
For of will return the actual values - {1, 2}

What are literals.? and what is a literal base object.?

What are the two types of functions in JS. Explain with examples.

  1. Named functions - function name(){}
  2. Unnamed(Anonymous) functions - ()=>{}

What is a event object

Event is object that is keep track of the events that is happening in the web page, it contains target...etc.For each event JS is creating E object which is can be passed to a handler function

What is jQuery.?

jQuery is a third party library that make an abstraction layer on the js. It makes write common js function easier. Fast and simple

What are the benefits of using jQuery?

Simplified DOM Manipulation, Increased productivity, Documentation and Community Support

What are the traversing methods that you have used in jQuery and when do we need them.?

.find(): This method selects all descendant elements that match a specified selector.
.parent(): This method selects the direct parent element of the selected element(s).
.children(): This method selects all direct child elements of the selected element(s).
.siblings(): This method selects all sibling elements of the selected element(s).
.prev(): This method selects the immediately preceding sibling of the selected element(s).
.next(): This method selects the immediately following sibling of the selected element(s).
.closest(): This method selects the closest ancestor element that matches a specified selector.

Why JS is introduced to have first class functions.?

In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.

Top comments (0)