js-basics-online-shopping-lab

时间:2021-05-06 09:37:42
【文件属性】:
文件名称:js-basics-online-shopping-lab
文件大小:8KB
文件格式:ZIP
更新时间:2021-05-06 09:37:42
JavaScript 网上购物 目标 将装满商品的购物车建模为JavaScript中的对象数组。 使用for循环遍历数组 使用ES6 ${template literals}而不是"regular, " + "old " + string + " concatenation." 改进条件并控制流程,使牛津逗号变得不可思议。 指示 我们从一个指向空数组的cart变量开始。 为了创建可运行的购物车,您必须编码以下五个功能: addToCart()函数接受一个参数,即项目的名称。 使用该传入的字符串创建代表该项目的新对象。 该对象应由两个键值对组成: { itemName: name of the item, itemPrice: price of the item, } 。 随着添加更多商品, cart应开始看起来像这样: [ { itemName:"bananas", itemPrice: 17 }, {
【文件预览】:
js-basics-online-shopping-lab-master
----index.js(383B)
----package.json(1KB)
----test()
--------root.js(589B)
--------index-test.js(5KB)
----index.html(631B)
----CONTRIBUTING.md(2KB)
----LICENSE.md(1KB)
----.gitignore(684B)
----.learn(133B)
----README.md(4KB)

网友评论