[英]I am new to firebase but have been using java script for a while but i don't understand what snap => does and why its used
我開始使用firebase並在傳遞值時遇到了snap =>
:
var rh = document.getElementById('rh');
var dbref = firebase.database().ref('text')
dbref.on('value', snap => rh.innerText = snap.val())
我想了解它的作用和用途。
這只是函數的簡單語法。 代替:
function f(snap) {
return "hello world";
}
const c = f;
您可以編寫以下內容以使其更易於閱讀:
const c = snap => return "hello world";
現在c
是一個常量,上面的函數保持不變。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.