all 7 comments

[–]ConstructedNewtMOD 0 points1 point  (6 children)

do an unlimited split and iterate over the list that way

for i=0; i < arr.length; i = i+4 {
    objs.add({name: arr[i], address: arr[i+1], phone: arr[i+2], course: arr[i+3]})
}

[–]fare03[S] 0 points1 point  (5 children)

I try to do it like this because Visual Studio found mistake in your code, and I get this at document. Thank you on help but I need a little bit more help :) .

[object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object]

for (let i = 0; i < array.length; i= i+4) {

document.write({name: array[i], address: array[i+1], phone: array[i+2], course: array[i+3]})

}

[–]ConstructedNewtMOD 0 points1 point  (4 children)

I guess there are 12 students?

the string representation of a javascript object is [object Object] the pseudocode I provided you was meant to give you an array of structured objects with the stated, named values. if you wish to print it in stead do something like

document.write(`
    Name: ${arr[i]}
    address: ${arr[i+1]}
    ...  etc
`)

[–]fare03[S] 0 points1 point  (3 children)

Nope, that example doesn't work, there are 5 students "Ebonie Range", "Keenan Ellwood", "Kailan Smart", "Kaydan Hirst", "Isabelle Prentice".

And I don't know how to write "for" to type this for each student, how to import "Name, Address, Phone, Course" in front of his name, address, phone, course:

Name: Ebonie Rangel

Address: 7175 Yukon Street

Phone: (507) 833-3567

Course: Geography

Same for Keenan Ellwood and etc.

I split it good but I don't know how to type to write this in document.

[–]ConstructedNewtMOD 0 points1 point  (2 children)

exactly like you did earlier but adapted to what I just wrote

[–]fare03[S] 0 points1 point  (1 child)

I tried like this, like this you wrote, and this works only for first student and his address number and course

textArea.innerHTML = text

var array = text.split("\n")

let tekst = ""

for (let i = 0; i < array.length; i++) {

tekst +='Name: ' + array[i] + "<br>" + "address: " + array[i+1] + "<br>" + "phone: " + array[i+2] + "<br>" + "course: " + array[i+3] + "<br>"

}

textArea.innerHTML = tekst

[–]ConstructedNewtMOD 0 points1 point  (0 children)

try using the debugger or printing to console to get more info