LinMinquan's Blog

Experience technology to change life

javascript中以大括号当参数

udacity中有一例子,发现其直接把一对空的大括号当作参数传给一个函数,不知道这语法是什么意思。 library.js var carlike = function(obj, loc) { obj.loc = loc; obj.move = move; return obj; }; var move = function() { this.loc++; } run.js var amy = carlike({}, 1); amy.move(); var ben = carlike({}, 9); ben.move(); 搜了下,其实这大括号(Curly braces)在javascript中表示的是object,空的大括号应该表示的是一个空的object,上面代码中在carlike里传了一个空的object,然后把这个object的loc赋值为1,最后return这个object为amy。 参考链接:https://stackoverflow.com/questions/4146984/curly-braces-inside-javascript-parameters-for-methods ====== Udacity Front End Developer , Lesson 9 , 的最后一节14.Conclusion 也提到了它这只是 passing a empty object to the carlike decorator.   Read more →

前端笔记

HTML: 用来在屏幕上画一条线。 Use the tag to define a thematic change in the content https://www.w3schools.com/tags/tag_hr.asp Udacity HTML/CSS Style Guide HTML Validator MDN HTML Element Reference page.  gives text strong importance, and is typically displayed in bold.  stress emphasis CSS: # 后跟的是ID, . 后跟的是class [] 里跟的是attribute css它的代码被浏览器load是有顺序的,代码越后面,越迟被load,后面的代码会overwrite前面的代码,如果只是想稍微修改一下代码,可以在css的最后加一些代码。 CSS Validator Google Fonts Box-Shadow Web Safe Fonts Device Independent Pixels VS Hardware Pixels Device Pixel Ratio = ( Hardware pixels) / ( Device Independent Pixels ) Read more →