Skip to main content

Posts

Showing posts with the label display clock in javascript code

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!!!

Get Client IP Address using JavaScript and JSON

In this post, there are 2 online services which allow us to get client IP address . This is free resources and for more information’s about this. 1.       jsonip.com 2.       Smart-IP.net //Using jsonip.com $ .getJSON( "https://jsonip.com?callback=?" , function (data) { alert ( "Your IP address is :- " + data.ip); }); //Using Smart-IP.net $ .getJSON( 'http://smart-ip.net/geoip-json?callback=?' , function (data) { alert ( "Your IP address is :- " + data. host ); }); Example, < ! DOCTYPE html > < html > < head > < meta charset = "utf-8" / > < title > Get Client Machine IP Address using JavaScript and JSON < /title > < link rel = "stylesheet" href = "style.css" / > < script src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js" > < /script > < script type = "text/javascript" ...

Prototype in JavaScript

What is Prototype in JavaScript? How to create prototype in JavaScript? The prototype is a fundamental concept of JavaScript and its must to known JavaScript developers and a ll the   JavaScript objects  have an object and its property called prototype and its used to add and the custom functions and property. The example looks like, var employee = function () { //This is a constructor function. } //Crate the instance of above constructor function and assign in a variable var empInstance = new employee(); empInstance.deportment = "IT" ; console .log (empInstance.deportment); //The output of above is IT. The example with prototype as given below. var employee = function () { //This is a constructor function.} employee . prototype . deportment = "IT" ; //Now, for every instance employee will have a deportment. //Crate the instance of above constructor function and assign in a variable var empInstance = new employee()...

Object in JavaScript - Object Creation by Constructor, Function and Prototype

How to create a JavaScript object? The JavaScript object  is a collection of properties and the each property associated with the name-value pairs . The object can contain any data types (numbers, arrays, object etc.) The example looks like, Var myObject= {empId : “001”, empCode :”X0091”}; In the above example, here are two properties one is empId and other is empCode and its values are “001” and “X0091”. The properties name can be string or number. If a property name is number i.e. Var numObject= {1 : “001”, 2 :”X0091”}; Console.log(numObject.1);   //This line throw an error! Console.log(numObject[“1”]);   // will access to this line not get any error! As per my thought, the number property name should be avoided. Types of creating an object ( There are two types ) 1.       Object literals 2.       Object constructor Object Literals : This is the most common way to ...

display clock in javascript code

This code used for display counter clock using java-script as given below This is the html code for display ui as given below. Time Left   Minutes

difference between == and === in JavaScript

In this post, I am going to share the very interesting double equals  " =="   and   triple equals "=== ". It is  very confusing topic and most of the time peoples are confused. The details  example as given below. The double equals (==) are used for check only value of its variables but triple equals (===) are used for check value and type as well of its variables. 1.   The double equal “==” is an  auto-type  conversion  and it checks only value not type. 2.    The triple equal “===” is not auto-type conversion  and it check value and type both. For example, < ! DOCTYPE html > < html > < head > < meta charset = "utf-8" / > < title > Difference between == and === in JavaScript < /title > < script src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js" > < /script > < script > // alert(0 == false);...