Functions in JavaScript

What is a Function? A function is a block of code or a subprogram designed to perform a particular task. Function is executed only when it is called. This is called invoking/calling a function. Thus it eliminates writing the same code again and again. Values can be passed into functions and used within the function body. Function always returns a value, if no return type … Read more

Operators in JavaScript

What is an operator? Consider a simple expression 2 + 5 equals to 7. Here, 2 and 5 are called operands and the ‘+’ is called operator. JavaScript supports the following 5 types of operators: Arithmetic Operators Comparison Operators Logical (or Relational) Operators Assignment Operators Conditional (or ternary) Operators  Arithmetic Operators JavaScript supports the following arithmetic operators − Lets … Read more

Math Object in JavaScript

The JavaScript Math object used to perform mathematical tasks with numbers.Math is an object that has properties and methods. Math has no constructor. All Math’s properties and methods are static. To refer methods and properties use Math.propertName  and functions as Math.funcationName(). For example to access the constant pi use Math.PI To call the sine function use Math.sin(valuex), where valuex is a … Read more

JavaScript Overlays with Examples

There are different kinds of JavaScript overlays for modal dialogs for prompting, overlays for info or warning boxes, tabbed overlays, alerting users overlays for displaying complex data. The overlay can implement on HTML like images, links, forms, tables, any type of div and any can be styled with CSS, like rounded borders, shadows or gradients … Read more

Classes and Objects in JavaScript

A class is a set or category of things having some property or attribute in common i.e., car is a class having similar properties such as color, engine, gear, model number etc. The “class” construct allows us to define prototype-based classes. Syntax for declaring a class:

Objects Objects are the instance of classes i.e., … Read more

Javascript jquery checkbox checked, unchecked, ischecked

Here we will see the Javascript jquery checkbox checked and unchecked and ischecked examples. Input type checkbox How to create input checkbox in HTML.. for this, we have to use the input type checkbox. along with type we used other attributes line name value and id.

Jquery checkbox checked To select check boxes  $(“#ck1”).prop(“checked”,true); … Read more

Find the smallest number in an array JavaScript

Smallest number in JavaScript can be find in different ways we can use Math.min() in easy way. We can find the smallest number from given list. We use Math.min() function to find the smallest number. min is a predefined number that is available in Math class. Math.min() takes set of arguments or array to find … Read more

Call Javascript function from HTML

Call Javascript function from HTML can be done in following ways Call on button click Call on form submission Call on onload event JavaScript function call with parameters Call javascript function from HTML button click Here in HTML, a button is created on the button’s click event a method hello() is called.

We have … Read more

Cookies in JavaScript

What are Cookies? Normally, Cookies store user information in small text files.on your computer. A cookie is a piece of data that is stored on your browser to be accessed by your browser. Cookies are also saved as key/value pairs. Cookies will remember information about the user, when server forgets everything about the user after … Read more