I can’t get a global variable for a week, which I will then need to change and compare with the text input area (I need a balance that compares with the rate and always changes when I win or lose) value, but does not want to 2, writes can not read property started):
code start:
Meteor.startup(() => { var oneUser = Animals.find({},{limit:1}).fetch()[0]; console.log(oneUser); userAnimals = oneUser.started; console.log(userAnimals); return 0; }); Template.hello.helpers({ counter() { var oneUser = Animals.find({},{limit:1}).fetch()[0]; console.log(oneUser); if(oneUser){ userAnimals = oneUser.started; console.log(userAnimals); } return 0; } }); Here is a shot
undefined main.js:12 undefined main.js:12 Uncaught TypeError: Cannot read property 'started' of undefined at main.js:12 at maybeReady (meteor.js?hash=33066830ab46d87e2b249d2780805545e40ce9ba:927) at HTMLDocument.loadingCompleted (meteor.js?hash=33066830ab46d87e2b249d2780805545e40ce9ba:939) (anonymous) @ main.js:12 maybeReady @ meteor.js?hash=33066830ab46d87e2b249d2780805545e40ce9ba:927 loadingCompleted @ meteor.js?hash=33066830ab46d87e2b249d2780805545e40ce9ba:939 main.js:21 {_id: ObjectID, firsname: "Barsik", lastname: "Reshetnik", started: "122"} main.js:21 122