<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### `Object.freeze()` `Object.freeze()` 方法可以凍結一個對象,凍結指的是不能向這個對象添加新的屬性,不能修改其已有屬性的值,不能刪除已有屬性,以及不能修改該對象已有屬性的可枚舉性、可配置性、可寫性。也就是說,這個對象永遠是不可變的。該方法返回被凍結的對象。 * 淺凍結 * 深凍結 > https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze ### `Object.defineProperty(obj,prop,descriptor)` > 直接在一個對象上定義一個新的屬性,或者修改一個對象的現有屬性,并返回這個對象. #### 參數 * `obj`:目標對象 * `prop`:待定義或修改的屬性名稱 * `descriptor`:待定義或修改屬性的描述符 #### 示例 ```js var bValue; var o = {}; // 創建一個新對象 Object.defineProperty(o, "b", { get : function(){ return bValue; }, set : function(newValue){ bValue = newValue; }, enumerable : true, configurable : true, writable:true//為false時代表屬性"不可寫" }); ``` ### `IIFE` 即**立即執行函數表達式** ### How to convert a `Set` to an `Array`? ``` let setVal = new Set(['b','c','b','a']); //1.Array.from console.log(Array.from(setVal));//[b,c,a] //2.spread console.log([...setVal]) ``` ### js取隨機數 ```js Math.random() ``` ### 函數列表參數`arguments` 首先,它是一個類數組對象`Array-Like Object`,就是擁有`length`屬性,但不能使用數組方法(`forEach`,`map`); * 將`arguments`對象轉換為數組對象 ``` //1 arguments = [].slice.call(arguments); //2 arguments = Array.from(arguments) //3 [..arguments] ``` * [鏈接](https://segmentfault.com/a/1190000008620953) ### `commonjs`中`exports`與`module.exports`的區別 `exports`對象是通過形參的方式傳入的,直接賦值形參會改變形參的引用,但不能改變作用域外的值. 而`module.exports`不改變形參的 * * * * * ### ES5內置函數`Array.prototype.reduce()` >[info] The `reduce()` method applies a function against an accumulator and each element in the array (from left to right) to reduce it to a single value. 該方法是個累加器,適合將數組中的元素從左到右減少到一個單一的值。 >[success] `array.reduce(function(total, currentValue, currentIndex, arr), initialValue)` * `total`:必需,初始值或計算后的返回值; * `currentValue`:必需,當前元素; * `currentIndex`:可選,當前元素的索引; * `arr` :可選,當前元素所屬的數組對象。 ```js const array1 = [1, 2, 3, 4]; const reducer = (accumulator, currentValue) => accumulator + currentValue; // 1 + 2 + 3 + 4 console.log(array1.reduce(reducer)); // expected output: 10 // 5 + 1 + 2 + 3 + 4 console.log(array1.reduce(reducer, 5)); // expected output: 15 ``` #### `reduceRight()` >[info] The reduceRight() method applies a function against an accumulator and each value of the array (from right-to-left) to reduce it to a single value. ```js const array1 = [[0, 1], [2, 3], [4, 5]].reduceRight( (previousValue, currentValue) => previousValue.concat(currentValue) ); console.log(array1); // expected output: Array [4, 5, 2, 3, 0, 1] ``` ### 操作位符 | 運算符 | 用法 | 描述 | | --- | --- | --- | | 按位與( AND) | `a & b` | 對于每一個比特位,只有兩個操作數相應的比特位都是1時,結果才為1,否則為0。 | | 按位或(OR) | `a | b` | 對于每一個比特位,當兩個操作數相應的比特位至少有一個1時,結果為1,否則為0。 | | 按位異或(XOR) | `a ^ b` | 對于每一個比特位,當兩個操作數相應的比特位有且只有一個1時,結果為1,否則為0。 | | 按位非(NOT) | `~ a` | 反轉操作數的比特位,即0變成1,1變成0。 | | 左移(Left shift) | `a << b` | 將 a 的二進制形式向左移 b (< 32) 比特位,右邊用0填充。 | | 有符號右移 | `a >> b` | 將 a 的二進制表示向右移 b (< 32) 位,丟棄被移出的位。 | | 無符號右移 | `a >>> b` | 將 a 的二進制表示向右移 b (< 32) 位,丟棄被移出的位,并使用 0 在左側填充。 | ### 冷知識`+` ```js console.log(+'2');//2 console.log(+false)//0 console.log(+function(){console.log('inner')});//NaN console.log(+function(){console.log('inner')}());//"inner" console.log(+[])//0 console.log(+{})//NaN console.log(+[2])//2 ``` >[success] 作用:將任何值轉換為數字 ### `Object.create(null)`與`{}` `Object.create(null)`創建的對象沒有任何屬性和原型鏈,高度可定制,避免了原型鏈上同名方法被覆蓋的尷尬情況; [https://www.imooc.com/article/26080](https://www.imooc.com/article/26080) ### Linux下執行`npm install node-sass`報創建文件夾沒有權限 > `npm install --unsafe-perm` 解決 ? 就是說 npm 出于安全考慮不支持以 root 用戶運行,即使你用 root 用戶身份運行了,npm 會自動轉成一個叫 nobody 的用戶來運行,而這個用戶幾乎沒有任何權限。這樣的話如果你腳本里有一些需要權限的操作,比如寫文件(尤其是寫 `/root/.node-gyp`),就會崩掉了。 為了避免這種情況,要么按照 npm 的規矩來,專門建一個用于運行 npm 的高權限用戶;要么加 --unsafe-perm 參數,這樣就不會切換到 nobody 上,運行時是哪個用戶就是哪個用戶,即使是 root。 - [參考鏈接1](https://blog.csdn.net/u014069688/article/details/84327190) - [unsafe-perm](https://docs.npmjs.com/misc/config#unsafe-perm) ### Docker相關操作 ```bash # 列出所有容器 docker ps -a # 停止容器 docker stop containerId # 刪除容器 docker rm containerId # 進入容器 docker exec -it containerId bash ``` ### NPM帶秘鑰下載 ```bash npm install -g canoe-cli --registry=https://ipd-artifactory.cloudwalk.work/artifactory/api/npm/all-dept_npm-virtual/ --auth=YWxsLWRlcHRfYWxsLXJlcG8tdHlwZV9yZWFkX3VzZXI6QVA3R1gzMkJncFJhTEVYMVhpVUN1ck5oaWVx ``` ### ts找不到vue模塊 創建`vue-shim.d.ts`,聲明vue ```js declare module '*.vue' { import Vue from 'vue' export default Vue } ``` ### npm還原registry npm config set registry https://registry.npmjs.org ### ts中找不到自定義組件的模塊 `tsconfig.json`中`types`中添加聲明: ```js "types": [ "webpack-env", "./node_modules/vue-ui-components-template/types" ], ``` ### `vuex`中`action`傳入多個參數 已知Vuex中通過actions提交mutations要通過context.commit(mutations,object)的方式來完成 然而commit中只能傳入兩個參數,第一個就是mutations,第二個就是要傳入的參數 > 然而如果這么寫的話就會報錯:context.commit(mutations,item,num) 所以多個參數,需要通過字典的方式傳入 ### `Uncaught SyntaxError: Unexpected token <` 解決方法:publicPath 不要寫成相對路徑`'./'` 要寫成絕對路徑 `/` ### 暗黑模式 `mix-blend-mode: difference`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看