var name1 = Symbol("Description 1"); var name2 = Symbol("Description 2"); name1 = "John" name1 = "Smith" console.log(name1); If the value are unique than why John is overwriting Smith What is the use of Symbol in this code?
Beta. Check this article if you haven't seen it: medium.freecodecamp.com/my-giant-javascript-basics-course-is-now-live-on-youtube-and-its-100-free-9020a21bbc27
Hi, there is no data type null in javascript. If you declare a variable without initialization, it's type is "undefined". But if you initialize the variable to null, it's type is "object". As you said, null is a value that means "no value". Null is not a data type.
I respectfully disagree. 😊 developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript and docs.microsoft.com/en-us/scripting/javascript/data-types-javascript#the-null-data-type
7 років тому
Beau Carnes acording to ecma-262 Null is a type. null is the only a value
I see. The thing is, these ecma specifications are the ideal tha is not achieved in modern implementations of JS. I doublechecked both latest Chrome and latest Node and there simply is no Null type. The typeof null returns 'object' in both cases. I haven't checked SpiderMonkey though. So from practical perspective there is no Null type you could use to initialize a variable like let n = new Null();
Call it a bug in JS :) Typeof undefined is 'undefined' but typeof null is 'object'. Specifications are only that: specifications. But whenever you look there is no Null data type you could use in current JS implementations I checked.
In this video I am using Chrome's JavaScript console under 'view->developer->JavaScript Console'. Usually I use CodePen's console. To open click the 'console' button in the bottom left corner. To make CodePen's console appear on the right you have to click 'Change View' in the top right and change the layout.
Hi Beau. Thanks for putting so much effort into this . This tutorial is just amazing. I have a question. Why does plus operator and multiplication operator behave differently when used with a null value. 1 + null = 1; but 1 * null = 0;
Thanks for these tutorials, big fan of FCC. Ok, the undefined and Null is not, ahem, well defined. :). Speaking from what I have learnt from FCC itself, here is an e.g. of undefined -a bit different from Null. var test = function(a,b) { a+b; } console.log(test(1,2)); //this will give you undefined
Could you clarify your example? Seems like your function just doesn't return result. How is it connected to undefined? If you change a + b into return a + b - it's working just fine.
GRAND SUMMARY Booleans - Watch in video. Null - means nothing or zero if you do math with it ! Use when some variable has no value assigned to them. Undefined - is not similar to null. means that a variable has either not been declared at all OR has been declared but holds no value. yield NaN if you do math with it. Is NOT zero. Number - Watch in video. Symbols - Their instances are unique and immutable. so if two symbols, sym1 = Symbol ("foo") and sym2 = Symbol ("foo") are compared; sym1 === sym2 , it will give false. if you typecast them both to string, it will give true ! but typecasting to string also means that it will print like "Symbol(foo)" in console ... Object - It is a collection of properties. Properties themselves are key-value pairs.
great tutorial
but i think it is a lot much easier to understand Object type:
var myCar = {
make = "Ford",
model = "Mustang"
};
When do we use Symbol..exactly..? Excuse me could you write a brief example, please??
Hey thanks for this I've been studying javascript till I got up to this thanks for clarifying these.
Need more explanation on symbol and objects
var name1 = Symbol("Description 1");
var name2 = Symbol("Description 2");
name1 = "John"
name1 = "Smith"
console.log(name1);
If the value are unique than why John is overwriting Smith What is the use of Symbol in this code?
What's the point of:
var myNumber = null;
when:
var myNumber = 0;
takes fewer keystrokes?
null data type means a variable is neither declared nor assigned (initialized).
Meanwhile, because of JS type conversion null is evaluated to 0
@ouf cena thanks for answering!
Do these videos follow along with the original JS track or the new beta JS track better?
Beta. Check this article if you haven't seen it: medium.freecodecamp.com/my-giant-javascript-basics-course-is-now-live-on-youtube-and-its-100-free-9020a21bbc27
In the first example you did have to say....if(data === true) {..... I guess it just assumes true first???
Great Tutorials! i like them
Great tutorial!
Q: At 6mins, are .make and .model the properties of the Object?
Thank you for your videos!
Precisely!
Hmm I don't think so, maybe those are variable name of Ford and Mustang?
Hi, nice video, I wonder what text editor are you using?
i guess he is using codepen.io
Use Atom. I love it
var a = function(){}; console.log(typeof a);
Didn’t understand symbols
Hi, there is no data type null in javascript. If you declare a variable without initialization, it's type is "undefined". But if you initialize the variable to null, it's type is "object". As you said, null is a value that means "no value". Null is not a data type.
I respectfully disagree. 😊 developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript and docs.microsoft.com/en-us/scripting/javascript/data-types-javascript#the-null-data-type
Beau Carnes acording to ecma-262 Null is a type. null is the only a value
I see. The thing is, these ecma specifications are the ideal tha is not achieved in modern implementations of JS. I doublechecked both latest Chrome and latest Node and there simply is no Null type. The typeof null returns 'object' in both cases. I haven't checked SpiderMonkey though. So from practical perspective there is no Null type you could use to initialize a variable like let n = new Null();
Call it a bug in JS :) Typeof undefined is 'undefined' but typeof null is 'object'. Specifications are only that: specifications. But whenever you look there is no Null data type you could use in current JS implementations I checked.
which code editor are you using?
It looks like codepen.io
This seems to be codepen.io - i suggest using atom, sublime or vscode. I do switch between sublime and atom from time to time.
codepen.io
Beau in codepen how do I set it up to see the JS running live on the right?
In this video I am using Chrome's JavaScript console under 'view->developer->JavaScript Console'. Usually I use CodePen's console. To open click the 'console' button in the bottom left corner. To make CodePen's console appear on the right you have to click 'Change View' in the top right and change the layout.
Hi Beau. Thanks for putting so much effort into this . This tutorial is just amazing.
I have a question. Why does plus operator and multiplication operator behave differently when used with a null value.
1 + null = 1;
but
1 * null = 0;
Because you're adding 1 to 0. And you can't multiply anything with 0.
can't you? you can multiply and will get an answer of 0.
Bean means beautiful in French ! Where did you get that name you lucky guy
Thanks for these tutorials, big fan of FCC. Ok, the undefined and Null is not, ahem, well defined. :). Speaking from what I have learnt from FCC itself, here is an e.g. of undefined -a bit different from Null.
var test = function(a,b) {
a+b;
}
console.log(test(1,2)); //this will give you undefined
Could you clarify your example? Seems like your function just doesn't return result. How is it connected to undefined? If you change a + b into return a + b - it's working just fine.
Are this course actually in 2024?
any code editor will do just fine for Javascript
Objects in JS seem to work like how I guess you would use a dictionary in Python
GRAND SUMMARY
Booleans - Watch in video.
Null - means nothing or zero if you do math with it ! Use when some variable has no value assigned to them.
Undefined - is not similar to null. means that a variable has either not been declared at all OR has been declared but holds no value. yield NaN if you do math with it. Is NOT zero.
Number - Watch in video.
Symbols - Their instances are unique and immutable. so if two symbols,
sym1 = Symbol ("foo") and sym2 = Symbol ("foo") are compared; sym1 === sym2 , it will give false.
if you typecast them both to string, it will give true ! but typecasting to string also means that it will print like "Symbol(foo)" in console ...
Object - It is a collection of properties. Properties themselves are key-value pairs.
The real question is how many people from The odin project are here? 🤔 TOP RULES!
console.log("algo que seria genial, es que tuviera subtitulo en español.");
Something that would be great is that it had a subtitle in Spanish.
Your name is very hard............... what a difficult name? I can not synonym it though................