I am in the middle of creating a calendar in javascript but am contemplating using the date functions to retrieve values or splitting the date string to retrieve values. I tried looking up the big o for these functions but have not found any. I want to know what is fastest.
For example
var date = new Date();
date.toString().split(" ")[1]; //this will get month name
vs
var date = new Date();
date.getMonth() //this will get month
they might not be the same but my question is which one is faster.
edit i forgot toString.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…