What is the difference between Java and JavaScript?

Don’t be fooled by the term Java in both. Both are quite different technologies. The key differences can be summarized as follows: JavaScript variables are dynamically typed, whereas the Java variables are statically typed. var myVar1 = “Hello”;         //string type var myVar2 = 5;               //number type var myVar3 = new Object( );   //empty object type … Read more

What is the difference between innerHTML and append() in JavaScript?

InnerHTML is not standard, and its a String. The DOM is not, and although innerHTML is faster and less verbose, its better to use the DOM methods like appendChild(), firstChild.nodeValue, etc to alter innerHTML content innerHTML and append() are both JavaScript methods used to manipulate the content of HTML elements, but they have some key … Read more

What datatypes are supported in Javascript?

Number, String, Undefined, null, Boolean. In JavaScript, there are several data types that are supported. They include: Primitive Data Types: String: Represents textual data, e.g., “hello”. Number: Represents numeric values, e.g., 42. Boolean: Represents true or false values. Undefined: Represents a variable that has been declared but not assigned a value. Null: Represents the intentional … Read more

What is Javascript namespacing? How and where is it used?

Using global variables in Javascript is evil and a bad practice. That being said, namespacing is used to bundle up all your functionality using a unique name. In JavaScript, a namespace is really just an object that you’ve attached all further methods, properties and objects. It promotes modularity and code reuse in the application. In … Read more

What is unobtrusive javascript? How to add behavior to an element using javascript?

Unobtrusive Javascript refers to the argument that the purpose of markup is to describe a document’s structure, not its programmatic behavior and that combining the two negatively impacts a site’s maintainability. Inline event handlers are harder to use and maintain, when one needs to set several events on a single element or when one is … Read more