Skip to main content

Posts

Showing posts with the label associative arrays in JavaScript

How To modify the URL of page without reloading the page?

To modify the URL of page without reloading the page - To modify the URL of page without reloading the page using the “push State” function. Example – window . history . pushState ( 'page1' , 'This is page1 Title' , '/index.htm' ); ü   Stayed Informed –   Object Oriented JavaScript Interview Questions I hope you are enjoying with this post! Please share with you friends!! Thank you!!!

What will be the output of the JavaScript code?

What will be the output of the code below? var abc = { x: 10 }; var result = ( function () {     delete abc.x;     return abc.x; })(); alert(result); Answers:-  The output would be “undefined”. The delete operator is used to delete the property of an object. Here “abc” is an object which has the property “x”. It's a “self-invoking” function and we will delete the x property from object “abc”. When you try to return a deleted property, it will return “undefined”. Stayed Informed – Best JavaScript Interview Questions & Answers I hope you are enjoying with this post! Please share with you friends. Thank you!!

Why use DOJO Toolkit?

It helps us in DOM scripting and an event management and also it provides us an abstraction over the complex JavaScript functions. DOJO has great support for integrating with back end data store. It works seamlessly with REST services. We even extended Dojo's JSON-Rest-Store for adding custom encoding or decoding and  It worked like a charm . We can use ready made inbuilt components looks like, 1.       Arrays, 2.       Object, 3.       Classes and 4.       Many more It is easily with help of including an <input> tag in the HTML pages. We can start and developed web apps in shortens of time and It also providing us a well-conceived APIs and set of tools for maintaining our web apps. We can downloaded the DOJO Toolkit from http://dojotoolkit.org/ I hope this information helped you! Thank you!

How to Create a Simple Image Slider in JavaScript?

Dear Friends, In this Article i am going to explain about creating a simple slider in JavaScript. So let us start step by Step tutorial on How to create a simple image slider in JavaScript.  Before starting this Example you should know the following topics. What is JavaScript Arrays & How to Populate arrays in JavaScript? What is meant by Set Interval and Clear Interval in JavaScript? How to change image source dynamically with JavaScript? If you are not clear about the above mentioned topics, I strongly suggest you to please go through the above mentioned topics first. If you know above topics, let is start the example. Step 1:- Create a simple HTML Template as Follows with Image element with id " myImg " in it. < ! DOCTYPE html > < html > < head > < title > < /title > < /head > < body > < img src = "" id = "myImg" > < /body > < /html > Step 2:- ...

How do you define a class and its constructor?

A JavaScript Constructor is a function which is used as a constructor that allows you to create an object from a class. A constructor access is one of public, protected and private. Three ways to define a JavaScript class , 1.       Using as a function 2.       Using as Object Literals 3.       Singleton using as a function Stayed Informed - Why “ self ” is needed instead of “ this ” in JavaScript? The Syntax access NameOfAClass(parameters) { initialization code; } //Access as public public customer(parameters) { initialization code; } //Access as protected protected customer(parameters) { initialization code; } //Access as private private customer(parameters) { initialization code; } Examples as , //class declaration inJavaScript //constructor var customer = function (id, name, age) { } customer . prototype = {} //Instance variables members. va...

associative arrays in JavaScript

What is   associative arrays in JavaScript? What is array ? Array is a collection of index items and it is a number indexes. Some of programming language support array as named indexes and the JavaScript not support the array as name indexes and its provide only number indexes but provide this feature using the associative array. The array with name indexes are called associative array  and the associative array is provide a ways to store the information. The number index array example as given below      var   users =   new   Object();     users[ "Name1" ] =   "Anil 1" ;     users[ "Name2" ] =   "Anil 2" ;     users[ "Age" ] = 33;     alert(Object.keys(users).length);   //output is 3.      var  length = Object.keys(users).length;   // 3     The name index array example as given below ...