当我使用
function processData(input) {`console.log(fact(input));`}
function fact(input) {
if (input == 1 || input == 0) {
return input;
} else {
return input * fact(input - 1);
}
}
Run Code Online (Sandbox Code Playgroud)
我得到的输出是:
1.5511210043330986e+25
Run Code Online (Sandbox Code Playgroud)
但是我需要 :
15511210043330985984000000
Run Code Online (Sandbox Code Playgroud)
我为此输出做了什么。我无法包含任何库,因为它是在线测试,并且我无权添加库。
我使用代码:
var test = $.getJSON( "about.json");
console.log(JSON.stringify(test));
Run Code Online (Sandbox Code Playgroud)
和我 about.json 在同一个文件目录中,但我只有{"readyState":1} 我不知道是什么问题。如果我错了,请帮助我。
我从这里学到了很多关于索引和查找内容的知识 。
索引支持在 MongoDB 中高效执行查询。如果没有索引,MongoDB 必须执行集合扫描,即扫描集合中的每个文档,以选择那些与查询语句匹配的文档。如果查询存在合适的索引,MongoDB 可以使用该索引来限制它必须检查的文档数量。
但我还有一些疑问:
如果我错了,请帮助我。谢谢。
我的服务器正在使用端口:3000并且我正在使用节点,在服务器端表达,这在使用curl或REST客户端时工作正常.
ember cli server正在使用port:4200
我在environment.js上添加了此代码,用于将服务器连接到客户端.
contentSecurityPolicy: {
'default-src': "'none'",
'script-src': "'self' 'unsafe-inline' 'unsafe-eval'",
'font-src': "'self'",
'connect-src': "'self' http://localhost:3000",
'img-src': "'self'",
'report-uri':"'localhost'",
'style-src': "'self' 'unsafe-inline'",
'frame-src': "'none'"
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序适配器代码是:
import JSONAPIAdapter from 'ember-data/adapters/json-api';
export default JSONAPIAdapter.extend({
"host": "http://localhost:3000",
"namespace": "api"
});
Run Code Online (Sandbox Code Playgroud)
以这种方式运行我的ember服务器 ember服务器--proxy http://127.0.0.1:3000 在控制器上我使用ajax调用:
$.ajax({
type: 'POST',
url: '/blog',
contentType: 'application/json',
data: param,
processData: false,
success :
});
Run Code Online (Sandbox Code Playgroud)
它收到错误: POST http:// localhost:4200/blog 500(内部服务器错误)
我做了所有这些,但我不知道为什么它不起作用.如果您有任何想法,请帮助我.