(function(){
const preObj=document.getElementById('object');
const preObjRef = firebase.database().ref().child('object');
preObjRef.on('value', snap => console.log(snap.val()));
}());
I followed exactly some learning videos, but still receive this error...
the error in this line of code:
preObjRef.on('value', snap => console.log(snap.val()));
error text:
Uncaught SyntaxError: missing ) after argument list
My guess is that you're running this code in an environment that doesn't understand the ES6 fat-arrow syntax. In that case you can replace it with:
preObjRef.on('value', function(snap) { console.log(snap.val()); });
I'd also consider upgrading the environment where you run the code, because more and more systems assume ES6 support.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.