Hey everyone I have one problem. I am trying to concatenate a single value from array with the string but it is not concatenating.
Example
arr[] => ['R','b','c']
string => "am"
I want to arr[0] + string i.e.., concatenate first index value of array to string.
How can I do this without changing the data type of array or string just concatenate array to string.
Edit: Here is the code
function rotate() {
var string = document.getElementById("string").value
var str_arr = string.split();
document.getElementById("string").value = str_arr[string.length - 1] + string.substring(0, string.length - 1);
}
<fieldset>
<label for="name">String:</label>
<input type="text" id="string" name="string">
</fieldset>
<button type="submit" onclick="rotate()">Rotate</button>
['R','b','c']to'am'??string = arr[0] + string;?