User
Write something
Live Interview: System Design is happening in 4 days
What happened to my Firebase DB?
Hey guys, I'm trying to use my Task App that I created, but the data is not loading. It's simply stalling. What is going on here? The last thing I remember is that the DB was in some sort of test mode, but I wasn't really sure if I could make it public since I have ZERO security on it haha.... Here is a screen shot of what the console says on the app. Any idea how I can troubleshoot this and get it working again? Thanks! @Hayk Simonyan
0
0
What happened to my Firebase DB?
Traditional Function referring to the global objects/window in browser
Hayk, I was studying the this keyword video in the JavaScript course, but I was wondering when you said the traditional function was referring to windows in the browser, did you mean only when it is called outside of the function, like in this example below, where I wrote const fn = myObj.showWindow; fn(); ? This is the example ai gave me and ai said that showWindow is a traditional function inside the object, but when called as fn(), this refers to the global object (window in browser), not myObj anymore. Ai also said the only difference between a traditional function and a traditional method is the the traditional function is written using a colon, like the colon after showWindow below. Ai also said the difference between traditional function and method is that traditional function use the colon (:), it can be assigned to a variable before being called out of the function, while the traditional method is written without a colon, and it is called directly as object key, like it is myobj.function name. Is this correct about what the ai said and is that what you was saying when you said the this keyword in the traditional function refers to the global object/window in your browser? const myObj = { name: 'Amber', showWindow: function() { console.log(this); // Will reference window if called as a standalone function } }; const fn = myObj.showWindow; // Assign method to variable fn(); // 'this' now refers to window (global object in browser)
The Perform a task Function Exercise Practice
Hey Hayk, I was practicing the functions that perform a task. I learned something new from ai, but wanted your feedback. I learned this from Cursor ai. There are two, or at least two of the ways they mentioned to me that I can write the function that performs a task. The two ways are the direct action pattern function and the return pattern function. ///////////Return Pattern Function: function go(home) { return `I am going ${home}`; } go('to the house'); const houses = go('to the house'); console.log(houses); function age(years) { return `I am about to be ${years}`; } age('42 years old'); const msg = age('42 years old'); console.log(msg); function message(note) { return `Take a look at this ${note}`; } message('notebook'); const notepad = message('notebook'); console.log(notepad); function tagname(tagline) { return `Coding is fun and ${tagline}`; } tagname('exciting'); const tag = tagname('exciting'); console.log(tag); //////////////////////////////////// /////Direct Action Pattern function: function greet(username) { console.log('Hello', username); } greet('John'); function sayHey(name) { console.log('Welcome home. We really missed you', name); } sayHey('Lucy'); function welcome(teacher) { console.log('Welcome teacher', teacher); } welcome('Rudy'); function Hello(age) { console.log('My age is ', age); } Hello('29 years old'); function show(homework) { console.log('Show me what assignments you have', homework); } show('that your teacher told you to complete'); /////////////////////// I was doing the exercises and practicing the functions that perform a task before I practiced the exercises for the function that return a value. Cursor ai calls the one you was going over in the course the direct action pattern. Cursor broke down the step by step process on how to do the functions for both of these. For Return Pattern Function: Step1 :Write the function and what it will do(with it's parameter in the parenthesis).
If..... else if.... exercise practice & What I learned from ai
let age = 16; let access; if (age >= 0 && age <= 12) {access = "Access to G-rated movies only";} else if (age >= 13 && age <=16) {access = "Access to PG-13 movies";} else if (age >= 17 && age <= 20) {access = "Access to R-rated movies";} else {access= "Access to all movie ratings";} let hoursSlept = 6.5; let sleepQuality; if ( hoursSlept < 5) {sleepQuality = "Poor Sleep";} else if (hoursSlept >= 5 && hoursSlept <= 6.9) {sleepQuality = "Fair sleep";} else if ( hoursSlept >= 7 && hoursSlept <= 8.5) {sleepQuality = "Good sleep";} else { sleepQuality = "Oversleeping";} let age = 17; if (age >= 18) { "They are allowed to vote."; } else { "They aren't allowed to vote."; } let temp = 28; if (temp < 32) { console.log("It is freezing."); } else { console.log("It's not freezing."); } (This is logging it) or let temp = 28; let message; if (temp < 32) { message = "It is freezing."; } else { message = "It's not freezing."; } (This assigning it. The message variable is assigning the statement in the blocks, but you can still log it in the console.) I asked Copilot for some if else exercises and at first it gave me the double value or ampersand exercises to solve, and then I asked it for single value, and it gave me single value exercises to solve. I practiced both. Are these correct the way I practiced the exercises Hayk or is there something I missed or got wrong? I also want to share what I learned from ai was that, you should either log or assign in the if else statement blocks so JavaScript can do something with the statement like log it, assign it, show what is being printed. Ai also told me that I could assign a variable in the if else blocks without declaring it first , but if I did that it would make that variable a global variable and it would cause bugs and issues and it better to declare the variable after the condition variable before writing your if else statements to make the code more predictable and cleaner, like in the first two examples I practiced with age and hoursSlept.
Deploy backend RESTful API to Digital Ocean Droplet
Hayk, for this sprint, should I create a new droplet specifically for the backend, or should i deploy it on an existing one? @Hayk Simonyan
1-30 of 54
Dev Mastery
skool.com/devmastery
Break out the mid-tier developer trap. Get to Senior, fast.
Leaderboard (30-day)
Powered by