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

,發(fā)現(xiàn)MM床頭、床邊貼滿了紙條,上面寫滿了密密麻麻的E文。當時問MM,有必要這樣嗎?MM說絕對是學(xué)習(xí)E文這種靠死記硬背并且不能忘記東西的好方法。當時對E文極度排斥,所以并沒在意。現(xiàn)在想多么好的一個方法從身邊溜走了,我覺得放在學(xué)習(xí)編程中的基礎(chǔ)知識同樣適用,并且效果更好!因為各種基礎(chǔ)知識,API還有些相互關(guān)聯(lián)和有一定規(guī)律,你可以把它們打印出來貼在床頭或者抬眼可即的地方,經(jīng)常不經(jīng)意的掃描不僅可以加深記憶說不定那天還能悟出其中的精妙呢?
??????推薦象Java基礎(chǔ)API、JavaScript API doc、一些流行庫如prototye、jquery等的API都可以拿來貼在床邊,編碼時遇到可以快速查閱,平時沒事可以經(jīng)常掃描。保證你不再害怕面試時的基礎(chǔ)題,不再怕被這些API打斷了!
??????掌握好的學(xué)習(xí)方法往往事半功倍,所以強烈建議大家平時可以總結(jié)一些好的學(xué)習(xí)方法和技巧,最好與他人交流分享。會讓你的學(xué)習(xí)輕松而快樂,并且效果好!
posted on 2007-03-26 22:34
cresposhi 閱讀(2598)
評論(18) 編輯 收藏