-1

I have the codes below:

    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);

    });

The whitespaces I've added "GenReasoning: genRange + " " + genStan" doesn't work. What is the problem?

Can anyone help me with this?

Example results:

    GenabRange = Cat
    GenabStanine = Foo

    Output
       GenReasoning = Cat Foo

    Expected Output
       GenReasoning = Cat        Foo

Thanks

RJ Uy
  • 377
  • 3
  • 10
  • 20

1 Answers1

1

Use this code:

var genRange = "       ";

and this code:

var obj = {
    GenReasoning:genRange+"        "+genStan
};

Notes:

  means 'non-breakable space',
browsers will render this as exactly 1 space
instead of combining them
jondinham
  • 8,271
  • 17
  • 80
  • 137