in php, i do this to connect strings
(pseudo code)
$myString = "";
for($i = 0;$i < 10;$i++)
$myString .= $i;
echo $myString;
would give me 0123456789
you got the idea
,now, how can i do the same in javascript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Javascript uses the plus sign for string concatenation. So:
It is important to note that Javascript also uses the plus sign for numeric addition. This means that you can get into trouble with variable types.
This means that your PHP trick of adding numbers together to make string, as per your question, will only work if you start with a string variable. PHP can recognise for itself that you intend it to be a string operation because of the concat operator; Javascript doesn’t have that ability, so you have to tell it explicity by making sure that your variables are of the correct type.