Skip to content

Instantly share code, notes, and snippets.

View zackhillman's full-sized avatar

Zachary Hillman zackhillman

View GitHub Profile
@zackhillman
zackhillman / firebase_create.js
Created March 27, 2022 19:12 — forked from anantn/firebase_create.js
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {