xgqfrms / FEIQA

FEIQA: Front End Interviews Question & Answers
https://feiqa.xgqfrms.xyz
MIT License
7 stars 0 forks source link

__proto__ & prototype #28

Open xgqfrms opened 6 years ago

xgqfrms commented 6 years ago

__proto__ & prototype

inheritance & prototype chain

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto

https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript-DOM_Prototypes_in_Mozilla


https://stackoverflow.com/questions/3082791/javascript-and-proto-what-browsers-use-it

xgqfrms commented 6 years ago

remove-all-listeners

https://stackoverflow.com/questions/9251837/how-to-remove-all-listeners-in-an-element

https://www.cnblogs.com/xgqfrms/p/9552163.html

xgqfrms commented 6 years ago

image

https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain

xgqfrms commented 6 years ago

image

xgqfrms commented 6 years ago

listen EADDRINUSE :::6666

EADDRINUSE means that the port number which listen() tries to bind the server to is already in use.

https://stackoverflow.com/questions/9898372/how-to-fix-error-listen-eaddrinuse-while-using-nodejs

xgqfrms commented 6 years ago

windows 10 & port checker


# admin
$ netstat -a -b 

https://stackoverflow.com/questions/31837690/what-program-in-windows-10-uses-port-80/31868649#31868649

image


# CMD
$  netstat -o
$  netstat -a -o

https://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/how-do-i-determine-what-is-using-port-80/5ded7d0b-093c-43d9-9349-bf253265f99e

image

xgqfrms commented 6 years ago

how to check port 80 in linux

image

image

image

image

https://www.cyberciti.biz/faq/find-linux-what-running-on-port-80-command/

https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/


https://stackoverflow.com/questions/10628972/how-to-grep-listening-on-port-80-that-can-also-filter-other-port-contain-80-such

xgqfrms commented 6 years ago

regex

image

xgqfrms commented 6 years ago

css & animation

bug

.showPanel {
    display: block;
    /* height: 100%; */
    -webkit-transition: display 1.0s 1.0s ease-in;
    transition: all 1.0s 1.0s ease-in;
}

.hidePanel {
    display: none;
    /* height: 0; */
    -webkit-transition: display 1.0s 1.0s ease-out;
    transition: all 1.0s 1.0s ease-out;
}

// 这段 CSS 为什么没有过度效果呢? 

image

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties

xgqfrms commented 6 years ago

https://html.spec.whatwg.org/multipage/dnd.html#dnd

http://www.ietester.cn/

image

xgqfrms commented 6 years ago

Open Window with title


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Open Window with title</title>
</head>

<body>
    <button onclick="openWin(event)" data-uid="001">Open Window 1</button>
    <button onclick="openWin(event)" data-uid="002">Open Window 2</button>

    <button onclick="closeWin()">Close "myWindow"</button>

    <script>
        var myWindow = ``;
        let key = ``;

        function openWin(e) {
            key = e.target.dataset.uid;
            console.log(`key = ${key}`);
            if (myWindow === ``) {
                myWindow = window.open("./new-window.html", "myWindow", "width=200,height=100");
                // myWindow = window.open("", "myWindow", "width=200,height=100");
                myWindow.document.head.title.innerHTML = "new title";
                // myWindow.document.body.innerHTML = `<h1>key : ${key}</h1>`;
            } else {
                myWindow.document.head.title.innerHTML = "new title";
                // myWindow.document.body.innerHTML = `<h1>key : ${key}</h1>`;
            }
        }

        function closeWin() {
            myWindow.close();
        }
    </script>
</body>

</html>
xgqfrms commented 6 years ago

image https://codepen.io/webgeeker/full/PdGGPr/ image

xgqfrms commented 6 years ago

SVN 忽略 文件夹

image

xgqfrms commented 6 years ago

小药箱

image

xgqfrms commented 6 years ago

kill -9 PID


#!/bin/sh

# echo "^-v-^ JSON DB is running in development env!" && npm run db

# echo "^-v-^ JSON DB is running in development env!" && nodemon -w ./server.js localhost 8888

JSONDB="nodemon -w ./server.js localhost 8888"

${JSONDB} &
# chmod +x db.sh
# sudo ./db.sh
# nodemon -w ./server.js localhost 8888

# /bin/sh db.sh

# ps -ef | grep node
# sudo kill -9 <PID>
xgqfrms commented 6 years ago

linux kill all node process

https://www.brighthub.com/computing/linux/articles/68762.aspx https://www.cyberciti.biz/faq/kill-process-in-linux-or-terminate-a-process-in-unix-or-linux-systems/

https://www.digitalocean.com/community/tutorials/how-to-use-ps-kill-and-nice-to-manage-processes-in-linux

https://www.linux.com/learn/intro-to-linux/2017/5/how-kill-process-command-line

# kill - Kill a process by ID

# killall - Kill a process by name
xgqfrms commented 6 years ago

aux


$ ps aux | grep chrome

# a = show processes for all users

# u = display the process's user/owner

# x = also show processes not attached to a terminal

https://www.linux.com/learn/intro-to-linux/2017/5/how-kill-process-command-line

xgqfrms commented 6 years ago

killall

https://www.linux.com/learn/intro-to-linux/2017/5/how-kill-process-command-line

# kill all node PID

$ killall -9 node

image

killall

node

https://stackoverflow.com/questions/31649267/how-to-kill-a-nodejs-process-in-linux

https://linux.die.net/man/1/killall

https://askubuntu.com/questions/607253/ps-xa-grep-node-to-kill-specific-process

https://stackoverflow.com/questions/31649267/how-to-kill-a-nodejs-process-in-linux

xgqfrms commented 6 years ago

ES6

dynamic module imports

http://2ality.com/2017/01/import-operator.html#async-functions-and-import


<!-- template -->
<div data-div="templates-special-empty-placeholder">
    <template data-template="template-special-empty-placeholder">
            <section class="gildata_main-module-content-box data-handle-content" data-box="empty-placeholder-overflow-scroll-box" data-handle="content" data-uid="special-empty-placeholder">
            </section>
            <!-- <script src="../templates/special-empty-placeholder.js"></script> -->
            <script>
                const moduleSpecifier = "../templates/special-empty-placeholder.js";

                import(moduleSpecifier).then((module) => {
                    console.log(`module =\n`, module);
                    module.emptyModule();
                });
            </script>
    </template>
</div>
xgqfrms commented 6 years ago

module uid

https://codepen.io/webgeeker/pen/yxazNK

image

xgqfrms commented 6 years ago


(async () => {
    const myModule = await import('./myModule.js');
})();

async function main() {
    const myModule = await import('./myModule.js');

    const {export1, export2} = await import('./myModule.js');

    const [module1, module2, module3] =
        await Promise.all([
            import('./module1.js'),
            import('./module2.js'),
            import('./module3.js'),
        ]);
}
main();

dynamic imports

https://www.npmjs.com/package/node-es-module-loader https://github.com/airbnb/babel-plugin-dynamic-import-webpack

https://webpack.js.org/guides/code-splitting/#dynamic-imports

xgqfrms commented 6 years ago

webpack 多页面配置

https://github.com/shaodahong/webpack-more/blob/master/webpack.config.js

async await

https://github.com/shaodahong/jd-happy/blob/master/index.js

web interview

https://github.com/shaodahong/web-topic https://github.com/alex/what-happens-when https://github.com/skyline75489/what-happens-when-zh_CN

gitbook

https://github.com/HIT-Alibaba/interview/blob/master/package.json

deploy.sh

https://github.com/HIT-Alibaba/interview/blob/master/develop.sh


#!/bin/sh
cd ..
mkdir interview-gitbook
cd interview-gitbook
git init
git remote add origin https://github.com/HIT-Alibaba/interview.git
git fetch
git checkout gh-pages
cd ../interview
cd source
gitbook install
cd ..
xgqfrms commented 6 years ago

http://2ality.com/2017/01/import-operator.html#async-functions-and-import

https://webpack.js.org/guides/code-splitting/#dynamic-imports

Code Splitting & Lazy Loading

https://webpack.js.org/guides/lazy-loading/ https://alexjoverm.github.io/2017/07/16/Lazy-load-in-Vue-using-Webpack-s-code-splitting/ https://router.vuejs.org/guide/advanced/lazy-loading.html image

https://reacttraining.com/react-router/web/guides/code-splitting image

https://dzone.com/articles/lazy-loading-es2015-modules-in-the-browser

https://webpack.js.org/guides/caching/

xgqfrms commented 6 years ago

ES6 polyfills

String.includes()

includes.js

https://github.com/mathiasbynens/String.prototype.includes/blob/master/includes.js

Array.includes()

babel-polyfill

https://babeljs.io/docs/en/babel-polyfill/

xgqfrms commented 6 years ago

202 Platform 启动 JSON server 脚本命令 (新项目)

cd /usr/local/apache2/webapps/tPlatform/api &&./db.sh

http://10.1.5.202:7777

202 F10 启动 JSON server 脚本命令 (旧项目)

cd /usr/local/apache2/webapps/F10/api &&./db.sh

http://10.1.5.202:8888

查看所有 node 进程

ps -ef | grep node

关闭所有 node 进程

killall -9 node

xgqfrms commented 6 years ago

type bug

https://www.layui.com/doc/modules/layer.html#type

image

xgqfrms commented 6 years ago

MBP 如何通过数据线与 Android 手机,交换数据呀?(蓝牙链接总是莫名其妙的断开)

xgqfrms commented 6 years ago

visibilityState

就是页面不可见的情况下就会出现问题

document.visibilityState 试下在页面最小化的时候清除定时器

https://developer.mozilla.org/zh-CN/docs/Web/API/Document/visibilityState

xgqfrms commented 6 years ago

JSON & ECMA-404

http://10.1.5.202/deploy/http/operate/showfile?{%22upgrade_id%22:%22DataService202%22,%22des_path%22:%22/SYDBS2/etc/DataService/83/root.json%22}

https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf

https://json.org/json-zh.html

let shitJSON = "{
  version: '1.0',
  defaultSchema: 'root',
  schemas: [
    {
      name: 'root',
      cache:'false',
      type: 'custom',
      factory: 'org.gil.sydb.server.schema.BaseSchemaFactory',
      operand: {
           tables:['*']
      }
    },
    {
      name: 'news',
      type: 'custom',
      factory: 'org.gil.sydb.server.schema.BaseSchemaFactory',
      operand: {
       tables:['MockTable']
      }
    }
  ]
}
";

JSON.parse(json.data);

> M82:2 Uncaught SyntaxError: Unexpected token v in JSON at position 4
    at JSON.parse (<anonymous>)
    at <anonymous>:1:6

// let json = data.replace(/\\n/ig, ``);
//     json = JSON.stringify(json, null, 4);

image

xgqfrms commented 6 years ago

image https://bgr.com/2018/08/29/galaxy-note-9-new-features-water-carbon-cooling-system/

xgqfrms commented 2 years ago

Flag Counter

©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!