Posts

Showing posts with the label Full stack development

Java Script program to display current date and time using HTML.

Image
 Date and time are the important factors for real time applications. JavaScript includes inbuilt class to get the date and time. date()  is the inbuilt class.  This inbuilt class has many functions listed below.  getDate() - it provides the date as number(1-31)  getMonth() - it displays the month as number getFullYear() - it gives the year in four digit number getDay() - it shows the day of the week in number(0-6) getHour() - it displays the hour information(0-23) getMinutes() - it gives the minutes details( 0-59) getSeconds() -it provides  the seconds details (0-59) getMilliseconds()  -it finds the milliseconds details and gives the information( 0-999) getTime() - it shows the time. these are the inbuilt functions available in date(). Next, create a file in notepad ,save it as "DateDisplay.html" . The program is given below. The <head> tag  is used to set the heading as "Display current date and time" wit h <h1> tag. where <he...

Java script – conditional statement

Java script has many conditional statements. It is used to check whether the given condition is true or false. It has following type. ·        If ·        If else ·        If else if Each one is explained as follows. 1.     If statement: This is a simple condition checking statement. It has a syntax to follow. Syntax: If (condition) { Code…. }   Example:   if( a>10)    {           document.writeln(“The number is greater than 10”);    } This example checks the given number is greater than 10. If the condition is true,it prints the number is greater than 10. Next, a simple example which checks the given number is greater than 10 or not is shown below. 2.     if   else: This type of conditional statement is used to check the condition. if the condition is tru...

Java script operators

     Operators are used to perform mathematical, logical operations on variables. In javascript,it has many categories. They are listed below. 1.        Arithmetic operators 2.        Logical operators 3.        Bitwise operators 4.        comparison operators 5.        Assignment operators 6.        Others.   1.         1.  Arithmetic operators:      This is basic operator   which is used to perform arithmetic operations like addition, subtraction and so on. Operator Meaning Usage + Addition a+b ,a+50 - Subtraction a-b, a-10 * Multiplication a*b / Division a/b ...

Datatypes and Variables in java script

Image
Datatypes are used to hold the values of variables. JavaScript has two types of datatypes. ·        Primitive data types ·        Non-primitive data types Java script is a dynamic type. It is not important to mention the datatype earlier. Use “var” for variable. Primitive data types: Javascript has 5 primitive data types. They are listed below. Boolean : it represents zero or one value. Number : it represents numbers. String :it represents sequence of characters. Null : it represents no value. Undefined: if you want to define the value later, use this data type. Non- primitive data types: Javascript has 3 different types of non-primitive data types. They are given below. Array : It has a list of similar values Object : it is a instance of a class. Regexp : It is for Regular Expressions.   Variables:   Variables are so important for any language. It specifies the value. In javascri...