If I use Array.from()
method in a blank text qualtrics question, I do not get the expected output. Note that I believe Qualtrics implements javascript with JFE.
For example, the below code is some html that squares [1,2,3]
with map and with Array.from().
Map works, Array.from doesn't.
(Note)I see the same behavior if I input the javascript separately in the qualtrics javascript editor (as opposed to inputting it together with the html as below)
<p>The initial array before we square it is: <span id="initArr"></span> </p><br> <p>Squaring the numbers with map gives <span id="mapArr"></span></p><br> <p>Squaring the numbers with Array.from gives <span id="fromArr"></span></p> <script> let initArr = document.getElementById("initArr"); let mapArr = document.getElementById("mapArr"); let fromArr = document.getElementById("fromArr"); let basicArr=[1,2,3]; initArr.innerHTML = basicArr; mapArr.innerHTML = basicArr.map(x=>x*x); fromArr.innerHTML=Array.from(basicArr,x=>x*x); </script>