Hey Campers,
I am having an issue with functions returning something other that the value I expect. Below are two examples. The first one I am actually using, the second just as a test. Instead of returning a value when I console.log, it returns the name of the function.
In the second example, when I try to add 1 to the returned value of “test”, it shows the full text of the function with a 1 at the end, like it is a string somehow.
Any idea why this is happening?
var currentID = function(){
for(pi of paintings){
if(pi.img === closeupPic.img.src) return pi.id
}
}
console.log(currentID)
CONSOLE:
function currentID()
var test = function(){
return 99
}
console.log(test)
CONSOLE:
function test()
test += 1
console.log(test)
CONSOLE:
function(){
return 99
}1