我有以下代码:
var viewModel = kendo.observable({ SampleData: @Html.Raw(Json.Encode(Model))});
var genRange = " ";
var genStan;
$.each(viewModel.SampleData, function(idx, obj){
$.each(obj, function(key, value) {
if(key.toString() === "GenabRange") { genRange = value; }
if(key.toString() === "GenabStanine") { genStan = value; }
});
var obj = {
GenReasoning: genRange + " " + genStan
};
stud.push(obj);
});
我添加的空格“GenReasoning:genRange +”“+ genStan”不起作用。有什么问题?
任何人都可以帮我吗?
示例结果:
GenabRange = Cat
GenabStanine = Foo
Output
GenReasoning = Cat Foo
Expected Output
GenReasoning = Cat Foo
由于
答案 0 :(得分:1)
使用此代码:
var genRange = " ";
和这段代码:
var obj = {
GenReasoning:genRange+" "+genStan
};
注意:
means 'non-breakable space',
browsers will render this as exactly 1 space
instead of combining them