瞎扯淡 "<=" "=>" 混啦混啦,有木有?

miclle · December 07, 2011 · Last by im924106179 replied at February 04, 2012 · 3052 hits

一直搞前端的我,最近在用 Rails3 来重构网站,项目里也有用 chosen 这个 JavaScript select 插件,觉得相当不错,当选项很少时,我不想要那个搜索框,去看 chosen 的源码,在 543 行看到

if (this.form_field.options.length <= this.disable_search_threshold) {
  this.container.addClass("chzn-container-single-nosearch");
} else {
  this.container.removeClass("chzn-container-single-nosearch");
}

我看到有"<="这个符号,顿时想到 ruby 里面的"=>",呃,我把 JavaScript 里的小于等于给忘记了,汗啦!

向左走 向右走

Ruby 里面其实有个比较操作符:<=>

我经常在写 PHP 或 JS 的时候写成 ruby.... @_@

真是个细致活儿~

You need to Sign in before reply, if you don't have an account, please Sign up first.