vinicius!
vinicius!
KPCKevin Powell - Community
Created by vinicius! on 12/18/2024 in #front-end
Send generic responses from the api to the client or be more specific in the response?
Example: User Credentials Validation the field password sent it from the client doesn't match the password stored in the DB. Should i send a generic message in the response? like Invalid Credentials or i can be more specific like field 'password' is invalid. Same idea to others validations errors too... should i specifically tell the browser what was wrong with the request? Is there a convention in this situation? I mean... i can be specific about validation errors, others types of errors i should be more generic for security reasons.
20 replies
KPCKevin Powell - Community
Created by vinicius! on 12/14/2024 in #front-end
Closures works only because of lexical scope and scope chain?
i’m studying this fundamentals concepts of Javascript and i’m a bit confused. I thought closures was a features on its own, but what is actually happening is that a inner function keeps access of the scope of its parent function because of lexical scope and scope chain Example:
function outerFunction() {
let count = 0;

return function() {
count += 1;
return;
};
};
function outerFunction() {
let count = 0;

return function() {
count += 1;
return;
};
};
Because of lexical scope, the anonymous function will always have access to the scope of outerFunction, right? and because of scope chain, when this code execute, javascript will first look at the scope of the inner function looking for the declaration of the variable count. As it won’t find it there, he’ll them look it up in the parent scope. In the example above he’ll find it in the parent scope, but in a case where he didn’t find anything, he would keep climbing the hierarchy until the global scope and them throw a referenceError if don’t find at all So, lexical scope allows for a inner function access its parent scope whenever it wants bcs “remembers” that it was declared inside that scope and scope chain allows the inner function to use variables up in the scope hierarchy and those behaviors it’s what we call closures Is it right? Correct me if i’ve understood that wrong
5 replies
KPCKevin Powell - Community
Created by vinicius! on 12/13/2024 in #os-and-tools
After sending a PR, can i delete the forked repo from my github?
Or do i need to wait to be approved or denied?
4 replies
KPCKevin Powell - Community
Created by vinicius! on 11/23/2024 in #resources
Free Books - https://pressbooks.com/
I've just found this free virtual library and the quality is exceptional. Have a good read: https://pressbooks.directory/
1 replies
KPCKevin Powell - Community
Created by vinicius! on 11/9/2024 in #front-end
CSS Custom Props Good Practice
First off, I recently found out that local custom properties in CSS can be inherited by child elements, and I’m honestly blown away 🤯. Second, I have a CodePen with a snippet that illustrates my question. Is it considered best practice to set custom properties on elements and then modify their values with inline styles? Everywhere I look, people advise against inline styles, so now I’m unsure if this case is an exception or if there’s a better approach. I set --_hue: 10 local custom props inside .card element, then i changed the colors of the two others elements with inline-styles https://codepen.io/bavosadev/pen/vYoQPvy please ignore all random values, i just wanted to play with calc() a little
4 replies
KPCKevin Powell - Community
Created by vinicius! on 11/9/2024 in #back-end
REST API and RESTful API are the same thing?
if not, what’s the difference? Are they both idempotent? both send stateless requests? or those are not the differences?
8 replies
KPCKevin Powell - Community
Created by vinicius! on 10/21/2024 in #front-end
JS Garbage Collector
In js, primitive values don't get garbage collected, right? but if a object is set in the global scope, do they get garbage collected?
27 replies
KPCKevin Powell - Community
Created by vinicius! on 9/17/2024 in #front-end
Let's discuss the relative unit 'em'
I can't wrap my head around the concept of 'em'. Actually, the hole concept of spacing using units relative to the font-size is difficult for me. Let's take a default example: responsive padding of a button. Setting the padding of this button to use 'em' will make it relative to the font-size of the closer parent element, right? Well, what I don't understand is, what if this parent element is a 'div', or some other elements which we do not set font-sizes? By default, shouldn't they have the root font-size '16px'? If so, what makes it different from using the unit 'rem'? Or should i set a font-size to these elements as well? articles, kevin’s videos and others sources to help me understand this concept is more than welcome
31 replies