Use a Conditional in Loop function code error


#1


Use a Conditional in Loop function


core/lib/api/node.js:144:10)
at compile (/usr/lib/node_modules/babel-register/lib/node.js:129:20)
at loader (/usr/lib/node_modules/babel-register/lib/node.js:158:14)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (test.js:2:17)
at Module._compile (module.js:456:26)
at loader (/usr/lib/node_modules/babel-register/lib/node.js:158:5)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /usr/lib/node_modules/mocha/lib/mocha.js:220:27
at Array.forEach (native)
at Mocha.loadFiles (/usr/lib/node_modules/mocha/lib/mocha.js:217:14)
at Mocha.run (/usr/lib/node_modules/mocha/lib/mocha.js:469:10)
at Object. (/usr/lib/node_modules/mocha/bin/_mocha:404:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:945:3


var React = require('react');
var ReactDOM = require('react-dom');

var fiftyFifty = Math.random() < 0.5;

// React.createClass call begins here:
var TonightsPlan = React.createClass({
  render: function(){
    var task;
    if (fiftyFifty) {
      task = "Tonight I'm going out WOOO"
    } else {
      task = "Tonight I'm going to bed WOOO"
    }

    return <h1>{task}</h1>;
  };
});


#2

Hi these lines

task = "Tonight I'm going out WOOO"
task = "Tonight I'm going to bed WOOO"

you should put task equal to a h1 tag so instead of the " " you should put it around

<h1>here</h1>

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.