coding with ☕️
2 subscribers
262 photos
14 videos
11 files
165 links
Anwendungsentwicklung
Download Telegram
function sayHi() {
alert( this.name );
}
function BigUser() {

this.name = "John";

return { name: "Godzilla" }; // <-- returns this object
}

alert( new BigUser().name ); // Godzilla, got that object
function BigUser(){
this.name = "Fotima"

return {name: "Godzila"};
}
alert(new BigUser().name );
console.log(new BigUser())
`with "New Operator" we can call in "console.log" with " ( ) "
function BigUser(){
this.name = "Fotima"

return {name: "Godzila"};
}
alert(new BigUser().name );
console.log(new BigUser().name)
let id = Symbol("id");
alert(id.description);
console.log(Symbol())
JavaScriptda primitive (oddiy) turlar bu oddiy qiymatlar bo‘lib, ular obyekt emas, o‘zgaruvchining o‘zida saqlanadi va o‘zgarmas (immutable) bo‘ladi.

JavaScriptdagi primitive turlar:
String – "hello", 'world'

Number – 42, 3.14, -10

Boolean – true, false

Undefined – let x; (qiymati yo‘q)

Null – let y = null; (bo‘sh qiymat)

Symbol – Symbol("id") (noyob identifikator)

BigInt – 12345678901234567890n (katta sonlar uchun)
A primitive

Is a value of a primitive type.
There are 7 primitive types: string, number, bigint, boolean, symbol, null and undefined.


An object

Is capable of storing multiple values as properties.
Can be created with {}, for instance:
{name: "John", age: 30}.

There are other kinds of objects in JavaScript: functions, for example, are objects.
let john = {
name: "John",
sayHi: function() {
alert("Hi buddy!");
}
};

john.sayHi(); // Hi buddy!

One of the best things about objects is that we can store a function as one of its properties.
Common binary operators:

Arithmetic: +, -, *, /, %

Assignment: =, +=, -=, *=, /=

Comparison: ==, !=, ===, !==, >, <, >=, <=

Logical: &&, ||

Bitwise: &, |, ^, <<, >>, >>>

Ternary: condition ? expr1 : expr2 (Special case, but still binary because of two expressions)