Home » Archive

Articles in the Javascript Category

Javascript, Node.js »

[14 Aug 2018 | No Comment]

This article shows how you can base64 encode and decode string using both Nodejs and Javascript.
Javascript: Base64 encode/decode string
Encode String

Javascript »

[17 Jul 2018 | Comments Off on Javascript: Set object & Loop]

A Set object holds the unique values of any type like array or object. An array or any other iterable object can be passed to Set.
– It’s a new data structure introduced in JavaScript ECMAScript 6 (ES6).
– It has useful methods for iteration over the Set values.

Javascript »

[10 Jul 2018 | Comments Off on Javascript: Map object & Loop]

A Javascript Map object holds the key-value pairs of elements. An array or any other iterable object can be passed to the Map.
– Map is a new data structure introduced in JavaScript ES6.
– It’s an alternative to JavaScript Object for storing key/value pairs.
– It has useful methods for iteration over the key/value pairs.

Javascript »

[3 Jul 2018 | Comments Off on Javascript: Object & Loop]

This article deals with creating a Javascript object and using different functions on the object. We also see how we can loop through the object and get the values.
Create a new Javascript Object

Javascript »

[26 Jun 2018 | Comments Off on Javascript: Check if a variable is an Array]

This article shows how you can check if a Javascript variable is of an Array type.
There are different ways to check if a variable is an Array in Javascript.
1) First way

Javascript »

[19 Jun 2018 | Comments Off on Javascript: Check if a variable is an Object]

This article shows how you can check if a Javascript variable is of an Object type.
There are different ways to check if a variable is an Object in Javascript.
1) First way

Javascript »

[12 Jun 2018 | Comments Off on Javascript: Multi-dimensional Array & Loop]

This is a beginner tutorial on working with Javascript multi-dimensional arrays and looping through them.
Javascript Array is a list-like object. It is used to store multiple values in a single variable.

Javascript »

[29 May 2018 | Comments Off on Javascript: Array & Loop]

This is a beginner tutorial on working with Javascript arrays and looping through them.
Javascript Array is a list-like object. It is used to store multiple values in a single variable.
This article deals with creating a Javascript array and using different functions on the array. We also see how we can loop through the arrays and get the values.

Google, Javascript »

[3 Oct 2017 | Comments Off on Google Maps: Get Latitude/Longitude value on Click and on Mouse Move]

This article shows how to get latitude and longitude value when you click or move the mouse over Google Map.
In previous article, we had seen how we can Display Google Map with Marker when we have latitude and longitude value.

Google, Javascript »

[26 Sep 2017 | Comments Off on Google Maps: Create New Marker on Clicking the Map]

This article shows how to create a new marker whenever you click or double click on the Google Map.
In previous article, we had seen how we can Display Google Map with Marker when we have latitude and longitude value.
Here, we will be using the same code and adding a new functionality of displaying a new marker whenever users double click on the map. You can also add this functionality on “single click” instead of “double click” event. I will be showing both in the example code below.

Google, Javascript »

[19 Sep 2017 | Comments Off on Display Google Map with Marker using Latitude & Longitude Coordinates]

This article shows how you can generate Google Map and display it in your webpage when you have latitude and longitude coordinates value.
We will be using HTML and Javascript to display the Google Map.

Javascript »

[13 Mar 2017 | Comments Off on Javascript: Populate Select box OnChange with JS array/object]

This article show how to populate one select box by selecting option of another select box/list. We will use a Javascript object. Each key of the object contains array as value.
A first select box is populated with the Javascript object’s keys. Then when the value from the first select box is selected then based on that value, the second select box is populated.

Javascript »

[15 Oct 2012 | One Comment]

This article shows how to get selected value from dropdown box when a button is clicked.
Problem:
– There are multiple forms in a page.
– There is a dropdown select box in each form.
– The option value of the select box is website URL.
– There is a button type=button (not type=submit) in each form.
– User will select a value from the select box and click the button.
– I need to get the selected option value (which is website URL) and open the URL in new window.

Javascript »

[2 Jan 2012 | Comments Off on Javascript: How to Submit form and Change form action?]

This article will show you how to submit form and change form action using javascript. This is a very simple trick but it’s very useful and frequently used.
Submit Form using Javascript

Javascript »

[26 Sep 2011 | Comments Off on Javascript: Show Hide textbox text on focus]

This might be simple one but it is a very handy code. Generally, I see this being used in Search textbox where there is some text like ‘search…’ by default. And, when you put the mouse cursor on the textbox, the text is removed and then you can type your desired search text.
For this, two javascript event handler are used: onFocus and onBlur.