javascript sources
1 subscriber
1 photo
1 link
Hello world
Download Telegram
Forwarded from coding with ☕️
"function expression"
Forwarded from coding with ☕️
let func = function(arg1, arg2, ..., argN) {
return expression;
};
Forwarded from coding with ☕️
Function Declaration (An'anaviy Funksiya)
Forwarded from coding with ☕️
coding with ☕️
Function Declaration (An'anaviy Funksiya)
function sayHello() {
console.log("Hello!");
}
sayHello(); // "Hello!"
Forwarded from coding with ☕️
Function Expression (Ifodaviy Funksiya)
Forwarded from coding with ☕️
coding with ☕️
Function Expression (Ifodaviy Funksiya)
const sayHello = function() {
console.log("Hello!");
};
sayHello(); // "Hello!"
Forwarded from coding with ☕️
Arrow Function (Yoyuvchi Funksiya)
Forwarded from coding with ☕️
coding with ☕️
Arrow Function (Yoyuvchi Funksiya)
const sayHello = () => {
console.log("Hello!");
};
sayHello(); // "Hello!"
Forwarded from coding with ☕️
Qisqa yozuv: {} va return ni olib tashlash mumkin.
Forwarded from coding with ☕️
coding with ☕️
Qisqa yozuv: {} va return ni olib tashlash mumkin.
const add = (a, b) => a + b;
console.log(add(2, 3)); // 5
Forwarded from coding with ☕️
Constructor Function (Konstruktor Funksiya)
Forwarded from coding with ☕️
coding with ☕️
Constructor Function (Konstruktor Funksiya)
function Person(name, age) {
this.name = name;
this.age = age;
}
const person1 = new Person("Ali", 25);
console.log(person1.name); // "Ali"
Forwarded from coding with ☕️
Immediately Invoked Function Expression (IIFE)
Forwarded from coding with ☕️
coding with ☕️
Immediately Invoked Function Expression (IIFE)
(function() {
console.log("This runs immediately!");
})();
Forwarded from coding with ☕️
Generator Function (Generator Funksiya)
Forwarded from coding with ☕️
coding with ☕️
Generator Function (Generator Funksiya)
function* generator() {
yield 1;
yield 2;
yield 3;
}
const gen = generator();
console.log(gen.next().value); // 1
console.log(gen.next().value); // 2
Forwarded from coding with ☕️
function ask(question, no, yes){
if(confirm(question))yes()
else no()
}
ask("do you agere?"
function(){alert{"You agreed!"}; },
function(){alert{"You canceled the execution!"}; }
);
Forwarded from coding with ☕️
let userName = prompt("Your name?", "Alice");
let isTeaWanted = confirm("Do you want some tea?");

alert( "Visitor: " + userName ); // Alice
alert( "Tea wanted: " + isTeaWanted ); // true
Forwarded from coding with ☕️
let isBoss = confirm("Are you the boss?");

alert( isBoss ); // true if OK is pressed