JavaScript string newline character?

后端 未结 15 2090
终归单人心
终归单人心 2020-11-22 08:06

Is \\n the universal newline character sequence in Javascript for all platforms? If not, how do I determine the character for the current environment?

I

15条回答
  •  执念已碎
    2020-11-22 08:29

    printAccountSummary: function()
            {return "Welcome!" + "\n" + "Your balance is currently $1000 and your interest rate is 1%."}
    };
    console.log(savingsAccount.printAccountSummary()); // method
    

    Prints:

    Welcome!
    Your balance is currently $1000 and your interest rate is 1%.
    

提交回复
热议问题