d3js starter 2

by glam

HTML

<html>

  <head>
    <title></title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
  </head>

  <body>
    <div>
      <p></p>
      
    </div>
  </body>

</html>

JavaScript

d3.select('p')
	.datum(39)
  .text(function(d){
  	return 'select existing element, and using datum: ' + d + ' as a param';
  });
  
d3.select('div')
	.datum(80)
  .append('p')
  .text(function(d){
  	return 'Createe new p element with datum: ' + d + ' as a param';
  })