I do not understand why this test failed:
This ('concat string and arr', function (done) {var str = "update userprofile set firstname = 'Barbara', last name = 'jensen', cellphone = '5638499', email = 'me@gmail.com' 'Var' = '[' computer ',' business'] expectation of str + = "interests =" + arr var = "Update userprofile set firstname = 'Barbara', lastname = 'jensen', cellphone = '5638499', email = 'Me@gmail.com', Interests = ['Computer', 'Business'] "(SRR). Uneven (Expected) done ()})
The test result looks like this:
< / P>
when you do
"interests =" + arr toString
will override the object
to the toString
method, / P>
array
overrides the object. For the array
object, the toString
method joins the array and gives a string in which each array element is separated by commas . For example, the following code creates an array and uses toString
to convert the array into a string.
var monthNames = ['Jan', 'Feb', 'march', 'app']; Var myVar = monthNames.toString (); // Assign 'myVar
from January, February, March, April, to fix the case of your trial, you have to manually convert the array, such as (",") That
str + = "interests = [" MonthNames.map (function (current string) {return "'" + current string "" ";}) + "]";
No comments:
Post a Comment