Data Visualization with D3: Work with Dynamic Data in D3

need help in solving this callenge.
couldn’t understand the syntax.

Try this:
d3.selectAll(“h2”)
.data(dataset)
.enter()
.append(“h2”)
.text(“New Title”);

I think you want to secect All h2s and grab the data from the data set. You have to enter before you can append. Then append to h2 the text of “New TItle”.

At least, that’s how I understand it.

thank you so much …

Sure, I’m still learning too :blush:

1 Like
d3.select("body").selectAll("h2")

Might be old topic but its just small update for future generations. Task require from us to select ‘body’ then’ ‘h2’ elements …

Thank you - it makes sense.

Must select the body before we can select its elements.