01-npm模块安装机制
<p>相关题目链接:<a href="https://muyiy.vip/question/tool/20.html">https://muyiy.vip/question/tool/20.html</a></p>
<pre><code>发出npm install命令;
npm 向 registry 查询模块压缩包的网址;
下载压缩包,存放在~/.npm目录;
解压压缩包到当前项目的node_modules目录;
</code></pre>
<p><strong>今日一记:</strong>
題目:let shop = "华北-大龙发记-北京富力广场店-北京-010-59037003";
结果:let newShop = "华北-大龙发记-北京富力广场店";</p>
<pre><code>var shop = "华北-大龙发记-北京富力广场店-北京-010-59037003";
var formatShopArr = shop.split('-').slice(0,3).join('-');
console.log(formatShopArr)//=>华北-大龙发记-北京富力广场店</code></pre>
<p>解析:
1.字符串-数组-数组截取-转换字符串
2.字符串-数组-数组获取0,1,2下标的值-字符串拼接</p>