??????比如你是不是在面試的最關(guān)鍵時(shí)刻面對(duì)一道“基礎(chǔ)的”排序題抓耳撓腮?你在快樂(lè)編碼的時(shí)候被一個(gè)似曾相識(shí)的“基礎(chǔ)的”API打斷而翻箱倒柜找文檔?幾個(gè)人能說(shuō)自己全面的了解Java幾個(gè)基礎(chǔ)類庫(kù)?這些基礎(chǔ)的往往也是最重要的、最核心的。
??????這個(gè)方法其實(shí)由來(lái)已久,而我昨天在coding的時(shí)候突然覺(jué)得它非常的重要也非常的好,值得一用。昨天在寫個(gè)JavaScript的Calendar突然用到求一個(gè)浮點(diǎn)數(shù)的“天花板”(coders應(yīng)該都知道天花板是什么吧,呵呵。考慮到非coder,天花板就是大于這個(gè)浮點(diǎn)數(shù)的最小整數(shù),是不是很形象,其實(shí)編程也是一種藝術(shù))。硬是不記得那個(gè)天花板的方法怎么寫,雖然是滾瓜亂熟的個(gè)方法,但是因?yàn)楹芫脹](méi)用加上E文不好只要打斷正在狀態(tài)的思路去google,找到這個(gè)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!?
另外推薦一個(gè)絕佳的JavaScript doc地址 : http://developer.mozilla.org/en/docs/Core_
然后繼續(xù)編碼,發(fā)現(xiàn)剛才的思路已經(jīng)沒(méi)有了,極度郁悶!所以找一種把這些基礎(chǔ)熟記于心的方法非常重要,最重要是不要那么容易忘記。
??????記得大學(xué)時(shí)候一次偶爾去E文系MM的寢室

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