??????比如你是不是在面試的最關鍵時刻面對一道“基礎的”排序題抓耳撓腮?你在快樂編碼的時候被一個似曾相識的“基礎的”API打斷而翻箱倒柜找文檔?幾個人能說自己全面的了解Java幾個基礎類庫?這些基礎的往往也是最重要的、最核心的。
??????這個方法其實由來已久,而我昨天在coding的時候突然覺得它非常的重要也非常的好,值得一用。昨天在寫個JavaScript的Calendar突然用到求一個浮點數的“天花板”(coders應該都知道天花板是什么吧,呵呵。考慮到非coder,天花板就是大于這個浮點數的最小整數,是不是很形象,其實編程也是一種藝術)。硬是不記得那個天花板的方法怎么寫,雖然是滾瓜亂熟的個方法,但是因為很久沒用加上E文不好只要打斷正在狀態的思路去google,找到這個API:
Question: What mathematical functions are supported in JavaScript?
Answer: JavaScript supports the following mathematical functions (methods of the Math
object):
Math.abs(a) // the absolute value of a Math.acos(a) // arc cosine of a Math.asin(a) // arc sine of a Math.atan(a) // arc tangent of a Math.atan2(a,b) // arc tangent of a/b Math.ceil(a) // integer closest to a and not less than a Math.cos(a) // cosine of a Math.exp(a) // exponent of a Math.floor(a) // integer closest to and not greater than a Math.log(a) // log of a base e Math.max(a,b) // the maximum of a and b Math.min(a,b) // the minimum of a and b Math.pow(a,b) // a to the power b Math.random() // pseudorandom number in the range 0 to 1 Math.round(a) // integer closest to a Math.sin(a) // sine of a Math.sqrt(a) // square root of a Math.tan(a) // tangent of aNote that trigonometric functions assume that the argument is in radians, not degrees!?
另外推薦一個絕佳的JavaScript doc地址 : http://developer.mozilla.org/en/docs/Core_
然后繼續編碼,發現剛才的思路已經沒有了,極度郁悶!所以找一種把這些基礎熟記于心的方法非常重要,最重要是不要那么容易忘記。
??????記得大學時候一次偶爾去E文系MM的寢室

??????推薦象Java基礎API、JavaScript API doc、一些流行庫如prototye、jquery等的API都可以拿來貼在床邊,編碼時遇到可以快速查閱,平時沒事可以經常掃描。保證你不再害怕面試時的基礎題,不再怕被這些API打斷了!
??????掌握好的學習方法往往事半功倍,所以強烈建議大家平時可以總結一些好的學習方法和技巧,最好與他人交流分享。會讓你的學習輕松而快樂,并且效果好!