Activity
Mon
Wed
Fri
Sun
Oct
Nov
Dec
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
What is this?
Less
More

Memberships

The Freelancer Fastlane

11 members • $7/m

Booking Big Fish Clients

625 members • Free

Becoming Narc-Proof

115 members • Free

SEO School For Founders

383 members • Free

King’s Daughters Community

66 members • Free

Social Marketing Certification

2.6k members • Free

Million Dollar Words

37 members • Free

Kreator Notes

1.9k members • Free

Christian Victory and Freedom

170 members • Free

129 contributions to Dev Mastery
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)
0 likes • 3d
@Hayk Simonyan ,thank you Hayk.
0 likes • 3d
@Hayk Simonyan window.favoriteColor = 'light green'; window.favoriteFood = 'macaroni & cheese'; const obj = { name: 'Amber', age: 23, location: 'USA', myFavoriteThings() { console.log( `My favorite color is ${this.favoriteColor} and one of my favorite foods is ${this.favoriteFood}` ); }, }; const fn = obj.myFavoriteThings; fn(); (The first one is the traditional function that is referencing global object that are present, and ai also told me that window. whatever the property is had to be set at the top for traditional functions referencing the global objects for traditional objects with global objects) const obj = { hobby: 'coloring', myHobby() { console.log(`My hobby is ${this.hobby}`); }, }; const fn = obj.myHobby; fn(); (This second object is traditional functions without the global objects present.) Here is another example of a traditional function I practiced from the exercise that the ai gave me. I asked ai for practice exercises to practice the traditional function, and this is how I wrote it to one of the problems. It told me to print "My favorite color is and my favorite food is", this is how I solved it. Is both of these the correct the way I wrote traditional functions to reference the global objects/window in the browser for traditional functions with the global objects present and without the global objects present in JavaScript?
What I learned/experienced with a loop in JavaScript
Something I experienced today was when I put a loop that where the condition was always true, I saw in action where my browser slowed down as well as live server. When I deleted that loop that made the condition to be always true, and also changed from the loop count +=2, to -= , I closed live server and reopened it from VS Code. I wrote it like this in VS Code: let count = 19; while (count > 0) { console.log(count); count += 2; } When I changed it from count += 2; to count -= 2; , live server and my browser seem to work again and not slow down. At first, I didn't understand what was meant when in the course you said Hayk that certain things can cause the program to crash. When I moved the loop that made the condition always true, my browser and live server started working again. Now I think I learned and kind of understand what Hayk meant when He said that certain things can crash the program. I feel like that was what was happening was my browser and live server was crashing because when I wrote that loop in my code editor and opened live server it at first showed what was in the console, but allowed me to still scrolled up and down , but it was very slow and like it was gone stop scrolling. Then went back into vs code, live server stopped working when I came back. So I removed that loop that makes the condition to be always true, and closed live server and reopened it and it worked. What I learned was a way to spot something wrong or even that you might be using the wrong operator like in while loops after the console in the curly brackets, if you have += and it is supposed to be -=, and vice versa, I just learned that you can know that is the wrong operator is if when you open live server and you right click and the box to click on inspect wont come up or show, and another way to know is if nothing prints in the console(Which this one I learned from Hayk in the course), an another way is your live server page becomes unresponsive and other pages work(The live server page becoming unresponsive, could be an indicator that something is wrong , but I know that isn't always the situation).
1 like • 5d
@Hayk Simonyan , thank you Hayk, it's like I'm learning something new every day about web development and this is fascinating.
1 like • 5d
I also want to add about loops is that I just learned just now that with the continue keyword in JavaScript, to print only odd numbers and skip even numbers, you would write if (i % 2 === 0) continue; ,and to print only even and skip the odd numbers , you would write if (i % 2 !== 0) continue; to print only even numbers and skip odd numbers. In the break statement with the if (i % 2 === 0) and if (i % 2 !==0) whether you want to print even or odd numbers, you have to put the console. log before the break keyword in the curly braces. I also learned where you put the console.log in the break and continue statements can determine what values and what prints in the console. If you put console.log before the break keyword, it prints the value before stopping the loop, but if you put console.log after break it doesn't print the values in the console. If you put the console.log before the if statement, like above it and not inside the if statement, then it will print all the values based on what I saw just now and what ai told me. I also want to share this that I learned today.
How Basil landed a new role and negotiated +20% more in 1 month
Congrats to @Basil Gubara who landed a new developer role within a month of joining our program and even negotiated a +20% salary increase on top of what was set as the maximum offer. Watch this to break your limiting beliefs about the whole “market is oversaturated” nonsense and get inspired by what’s possible when you’re truly committed. Because developers who are committed to mastery are always in demand, no matter how bad the market is or how far AI advances.
2 likes • 5d
Congratulations Basil!!!!!!!!!!!!!!!!!!!!!!!!💎💎💎💎
Questions to ask when determining which of these loops to use
I thought of some questions to ask when determining what loops to use, and asked ai if that was correct, and ai told me yes. Questions to ask to see if a loop need to be used: - Do I have more than one item that needs to be updated, shown to the user or process in some way(If yes, use loops) - What tasks do I need to use loops for? - If yes, what type of loop do I need to use? (Which the second set of questions below can help determine which loop to use) These questions are for finding out what type of loop to run: - Do I know how many times I want this code or condition to run (if yes, use for loops, if no, use while loops)?, - Do I want to check to see if the condition is true (if so use do while loops) - Do I want/ is the condition supposed to run the code at least once even if it isn't true? (If so, use the do while loops) These are the questions and ai told me yes, this is correct, and I thought I would share this because it helped me to know when to use which loop, and I hope this help someone too because it helped me because I was a little confused about that. Hayk, if I got something wrong in what I learned, can you give me feedback? Can you give me feedback and what you think of this Hayk?
1
0
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).
1 like • 10d
@Hayk Simonyan oh like returning numbers or words?
1 like • 10d
@Hayk Simonyan , thank you Hayk. I get it now. It can use an input but return something different. Thank you Hayk.
1-10 of 129
SeaAmber Silver
6
1,451points to level up
@seaamber-silver-3648
Im SeaAmber, and I love learning. Learning is one of my favorite things to do.

Active 38m ago
Joined Jan 30, 2025
Powered by