这是我当前的文件夹结构
css
app.css
js
app.js
node-modules
index.html
node-server.js
package.json
Run Code Online (Sandbox Code Playgroud)
节点服务器托管index.html
,但我无法弄清楚如何获得app.js
并app.css
获得加载的文件.
index.html
加载它们:
<script src="js/app.js"></script>
<link rel="stylesheet" type="text/css" href="css/app.css"/>
Run Code Online (Sandbox Code Playgroud)
这是错误消息:
Failed to load resource: the server responded with a status of 404 (Not Found)
2http://localhost:3000/css/app.css Failed to load resource: the server
responded with a status of 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)
我知道我需要或加载模块或什么,只是无法弄清楚是什么.
谢谢
有没有办法包含所有的meta tag
,link rel
并script src
包含在一个文件中,然后需要该文件?
我问的原因是因为我有10-15行,我正在复制到每个文件中,并认为可能有另一种方式.
我将所有内容放在一个文件中并尝试了Jquery加载功能,但无济于事.
谢谢
使用reduce查找项目在数组中的次数.该数组可以递归地具有数组.
var foo = [
1,
[2, 3, 4],
4, [5,6,7], 4
];
Run Code Online (Sandbox Code Playgroud)
bar(foo, 4)
将返回3.
如果我有一个哈希数组,最好的迭代方法是什么?
var a = [{"a": "1"}, {"b": "2"}, {"c": "3"}]
for(var i in a) {
console.log(a[i]) //prints each hash
console.log(i) //prints the index
}
Run Code Online (Sandbox Code Playgroud)
如果我想得到a,b,c或1,2,3什么是最好的方法?
谢谢