Author: ShairyPortfolio

  • Array in JavaScript

    Array in JavaScript

    An array is a collection of elements that use the common name to store all the elements. Array always start from Memory Location Zero. It is lengthy process to store huge elements in a separate variable; Arrays solve this problem by storing all the elements into one variable. Types of Array One dimensional Array Multidimensional…

  • String Methods in Java

    String Methods in Java

    Extracting a Substring from a String slice() method is used to extract a part or substring from a string. This method takes 2 parameters: like str.slice(startIndex, endIndex). Example var str = “The Best IT Company in Ludhiana is ershairykalra.”; var subStr = str.slice(4, 19); document.write(subStr); Extracting a Fixed Number of Characters from a String JavaScript…

  • String in Java

    String in Java

    A string is a collection of characters that enclosed either within single quotes (‘) or double quotes (“). Example var name = ‘Shairy’; // Single quoted string var name = “Shairy!”; // Double quoted string Different properties and methods are used on string values. Getting the Length of a String To count the number of…

  • Get and Set Date Function in JS

    Get and Set Date Function in JS

    new Date (year, month, date, hours, minutes, seconds, ms) Getting date components getFullYear () =>Get the year (4 digits) getMonth () =>Get the month, from 0 to 11. getDate()=>Get the day of month, from 1 to 31 getHours() getMinutes() getSeconds() getMilliseconds() getDay()=>Get the day of week, from 0 (Sunday) to 6 (Saturday). Example const year…