I have looked into JS and the P5.js references and I can't figure out what's wrong with this code. I'm using p5.js with the DOM and Sound libraries
var year = 0
var yearST
function setup() {
createCanvas(1000, 750);
}
function draw() {
background(210)
textAlign(RIGHT,TOP)
yearST = str(year)
textSize(15)
console.log(yearST) //This is the var that matters
text(("Years survived: " + yearST), 990, 10)
}
The console.log() that logs yearST returns
function () { [native code] }
Please help, what's the problem with this code. (No changes when adding semicolons, I tried)
This is what it looks like when it is run in a browser: 1, That's supposed to be a 0 at the end of the string