Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div id = "csv">




                var popSize = 186;
var districts = [1,1,2,2,2,3,3,3,3,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,9,9,9,9,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12];

var ageCategories = [1,1,1,1,1,2,2,2,3,3,3,3,4,4,4,4,4,4];

var houseCategories = [1,1,1,1,1,1,1,2,2,2,2,2,3,3,4]

var citizens = [];

var App = new React.createClass({
 render: function(){
 var peopleText = "";
 for(var i = 0;i<popSize;i++){
 var person = {};
  //create a population with the age profile defined in ageCategories
 var ageCategory = _.sample(ageCategories,1);
 var ageCategoryText;
 if (ageCategory==1){ageCategoryText="child"}
 else if (ageCategory==2){ageCategoryText="teen"} 
 else if (ageCategory==3){ageCategoryText="adult"}
 else {ageCategoryText="senior"}  

 person.age = chance.age({type:ageCategoryText});
 person.gender = chance.gender();
 person.lastName = chance.last();
 person.firstName = chance.first({gender:person.gender});
 person.district = _.sample(districts,1)[0];
 person.favTeam = (Math.random()>0.6)?"Orbiters":"Crusaders";
 person.mayorVote = (Math.random()>0.3)?"Crenshaw":"Trymenaark";
  var houseCategory = _.sample(houseCategories,1);
 var houseCategoryText;
 if (houseCategory==1){houseCategoryText="House"}
 else if (houseCategory==2){houseCategoryText="Apartment"} 
 else if (houseCategory==3){houseCategoryText="Villa"}
 else {houseCategoryText="Mansion"}  

 person.houseType = houseCategoryText;
    var carCategory = _.sample(houseCategories,1);
 var carCategoryText;
 if (carCategory==1){carCategoryText="Scooter"}
 else if (carCategory==2){carCategoryText="Rents Car"} 
 else if (carCategory==3){carCategoryText="Owns Car"}
 else {
      carCategoryText = (Math.random()>0.1)?"Limousine":"Helicopter";
     carCategoryText = "None";
      person.mayorVote = "None";

 person.vehicle = carCategoryText; 

 var personString = person.lastName + "; " + person.firstName + "; " + person.age + "; " + person.gender+ "; " + person.district + "; " + person.favTeam + "; "+ person.mayorVote + "; "+ person.houseType + "; "+ person.vehicle+"<br/>"  
 peopleText+= personString;
 return (
     <textarea value= {JSON.stringify(citizens)}/> 
 <div dangerouslySetInnerHTML={{ __html: peopleText}}>