SoFunction
Updated on 2025-04-10

The following are the following operations related to built-in objects, date objects and timers: Summary of JS front-end knowledge points

This article describes the built-in objects, date objects and timer related operations in the summary of JS front-end knowledge points. Share it for your reference, as follows:

Common built-in objects

  • Arguments: Function parameter set
  • Array: Array
  • Boolean: Boolean object
  • Date: Date object
  • Error: Exception object
  • Function: Function constructor
  • Math: Mathematical Objects
  • Number: Numeric object
  • Object: Basic Object
  • RegExp: Regex object
  • String: String object

Common methods for date objects

var d = new Date();

  • () Getting date 1-31
  • () Get Week 0-6
  • () Get Months 0-11
  • () Get the full year
  • () Get hours 0-23
  • () Get minutes 0-59
  • () Get seconds 0-59
  • () Get milliseconds
  • () Returns the cumulative number of milliseconds (calculated from midnight at 1970/1/1)
  • Get past millisecond numbers: () === () The expression value is true

Example:

var today = new Date();  // Get the current timevar today = new Date(1453094034000);
var birthday = new Date('December 17,1995');
var birthday = new Date('1995-12-17T03:24:00');
var birthday1 = new Date(1995,11,17,3,24,0);
()  // "1995/12/17 3:24:00 am"// Note: 0-11 numbers represent January-December, var a = new Date(2006,5,6) The result is 2006-6-6// 0-6 indicates the day of the week

Two timers

setInterval loop execution

(function(){
 // do your business
},100);

setTimeout is called only once

(function() {
 // do your business
},100);

Cancel of timer

  • clearInterval
var timer1 = setInterval(function(){
 clearInterval(timer1);
},100);

  • clearTimeout
var timer2 = setTimeout(function() {
 clearTimeout(timer2);
},100);

PS: Here are a few more practical online tools for daily calculation for everyone to use:

Online Date/Day Calculator:
http://tools./jisuanqi/date_jisuanqi

Online date calculator/phase difference day calculator:
http://tools./jisuanqi/datecalc

Online date day difference calculator:
http://tools./jisuanqi/onlinedatejsq

Online Day Calculator:
http://tools./jisuanqi/datejsq

For more information about JavaScript, readers who are interested in reading this site's special topic:Summary of JavaScript time and date operation skills》、《JavaScript+HTML5 special effects and techniques summary》、《Summary of JavaScript Errors and Debugging Skills》、《Summary of JavaScript data structure and algorithm techniques"and"Summary of JavaScript mathematical operations usage

I hope this article will be helpful to everyone's JavaScript programming.