Skip to content

Instantly share code, notes, and snippets.

@pooooriya
Created January 11, 2024 11:43
Show Gist options
  • Save pooooriya/1b3f33a422add8fd72adc15b9e5d960d to your computer and use it in GitHub Desktop.
Save pooooriya/1b3f33a422add8fd72adc15b9e5d960d to your computer and use it in GitHub Desktop.
Jalase 3 - JS Basic - Quera Bootcamp
// let name2 = "pouriya";
// 1. syntax
// 2. variable
// var
// let
// const
/**
* JsDoc
*/
// var name = "ali";
// let name2 = "pouriya";
// const name3 = "pouriya2";
// 2.1 scope
// global scope
// function scope
// module scope
// block scope
// {
// var name = "ali";
// const name3 = "pouriya2";
// }
// 2.2 hoisting
// attach to global scope - be bala tarin noqte file js eman
// 2.2.1
// declration 1.
// initialzation 2.
// use 3.
// 2.3 variable comparison
// ****var
// console.log(title);
// var title = "quera"; //1.declare //2.initilaztion
// 1.scope
// block scope -
// console.log(title2)
// {
// var title2 = "quera2";
// }
// console.log(title2)
// function scope +
// console.log(title2);
// function name() {
// var title2 = "quera2";
// }
// reassignable +
// var title = "2";
// title = 50;
// console.log(title);
// redeclrable +
// var title = "2";
// var title = "ali";
// var title = 50;
// 2.hoisting +
// console.log(name2, 1);
// if (true) {
// var name2 = "ali";
// }
// console.log(name2, 2);
// ****let :
// scope
// console.log(title2, 1);
// js har ja error bokhord code bad az an ra ejra nemikonad
// hata agar dar file(module) digari khata etefagh bioftad
// file(module) bad az an ejra nmishavad
// global scope
// console.log(title2, 1);
// let title2 = "ali";
// console.log(title2, 2);
// let name2;
// console.log(name2, 2);
// let name2; //declaration
// name2 = "ali"; //intilization
// var name3;//declaration
// name3 ="mohsen" //intilization
// block scope + hoist -
// console.log(age);
// if (true) {
// let age = 12;
// }
// console.log(age);
// function scope + hoist -
// console.log(name5); // undeifiend
// {
// let name5 = "majid";
// }
// console.log(name5);
// hoist -
// reassignable +
// let title3 = "ali";
// title3 = 10;
// title3 = 20;
// title3 = 30;
// console.log(title3);
// let title3 = "ali";
// console.log(title3);
// {
// var title3 = 50;
// }
// console.log(title3);
// let name3 = "ali"; // declare
// if (true) {
// name3 = "mohsen";
// }
// console.log(name3);
// redeclrable -
// console.log(name6, 2);
// let name6 = "ali";
// {
// console.log(name7, 0);
// let name7 = "mohsen";
// // console.log(name6, 1);
// }
// console.log(name6, 2);
// let title6 = "ali";
// let title6 = "pouriya";
// let title6 = "pouriya"; // global scope
// {
// // console.log(title6);
// let title6 = "mohsen";
// // console.log(title6);
// }
// console.log(title6);
// console.log(title6, 0); //und
// var title6 = "ali";
// {
// // console.log(title6, 1); // ali
// // let title6 = "mohsen";
// // console.log(title6, 2);
// }
// console.log(title6, 3);
// global scope =>
// block scope function scope <=
// const ec6
// scope ~~~~ let
// block scope +
// const x = 20;
// {
// console.log(x);
// // const x = 30;
// }
// console.log(x);
// function scope +
// function test3() {
// const x = "ali";
// }
// global scope
// console.log(x2);
// const x2 = "ali";
// console.log(x2);
// hoist -
// reassignable -
// const x = "ali";
// x = 20; //Assignment to constant variable.
// console.log(x);
// redeclare -
// const x ="";
// const x =""
// const x = " ali";
// {
// const x = "ali2";
// }
// console.log(x);
// let x ;
// x = 2;
// const x2;
// console.log(x2)
// nokte konkuri
// 1. declration
// 2. initilzation
// 3. usage access
// var => 1. -
// let => 1. ++
// const => 1.2 ++++
// 2. data structure
// 2.1 PREMETIVE
// string => رشته ای از کارکتر ها
// **** how to create?
// const name1 = "ali";
// const name1 = "ali";
// const name1 = `ali`;
// 1.concat
//1.1 template string ++++
// const greeting = `Hello ${a + b}`;
// console.log(greeting);
//1.2 concat method +++
// name2.concat()
//1.3 + (concat) ++
// const c = "hello" + " " + name2; //concat -
// console.log(c);
// **** methods ~~ function -- property ~~ value
// 1.length ~~ property
// const title = "ali12345";
// console.log(title.length);
// 2.concat ~~ method
// const name2 = "1";
// const name3 = "2";
// console.log(name2.concat(name3));
// 3.charAt() ~~ method
// const family = "babaali";
// console.log(family.charAt(0)) b
// overflow
// console.log(family.charAt(9)); ""
// console.log(family.charAt(-1)); ""
// 4. at() ES2022 ~~ charAt() ~~ method
// const family = "babaali";
// console.log(family.at(2));
// console.log(family[1]);
// 5. uppercase lowercase ~~ method
// const family = "baBaali";
// console.log(family.toUpperCase());
// console.log(family.toLocaleLowerCase());
// 6. trim() ~~ method
// const family = " [email protected] 2 ";
// console.log(family.trim());
// console.log(family.trimEnd());
// console.log(family.trimStart());
// 7. padEnd padstart ~~ method
// const phoneNumber = "9121234567";
// phoneNumber.padStart(11, 0);
// console.log(phoneNumber.padStart(11, 0));
// console.log(phoneNumber.padEnd(11, 0));
// 8. Slice Substring Substr ~~ method
// const fullname = "pouriya babaali";
// console.log(fullname.slice(10));
// console.log(fullname.slice(10, 14));
// console.log(fullname.slice(10, 4)); ""
// console.log(fullname.slice(0));
// console.log(fullname.slice(-1)); char akhar
// console.log(fullname.substring(10));
// console.log(fullname.substr(10, 4));
// 8. Replace ReplaceAll ~~ method
// const email = " [email protected] 2";
// console.log(email.trim());
// console.log(email.replace(" ", "")); //avali
// console.log(email.replaceAll(" ", "")); // hameie anhaee condition barqarare
// function ChangeFaToEn(fullname) {
// return fullname.replaceAll("۱", "1").replaceAll("۲", "2");
// }
// console.log(ChangeFaToEn("۱۲"));
// Search In String
// 9.includes
// const family = "babaali";
//console.log(family.includes("ba")); // boolean
//10. startWith endswith
// const family = "babaali";
// console.log(family.startsWith("b")); // boolean
// console.log(family.endsWith("i")); // boolean
// 11. Search
// const text = "Please locate where 'locate' occurs!";
// console.log(text.search("where"));
// console.log(text.slice(text.search("where")));
// 12. indexOf lastIndexOf
// const family = "babaali";
// console.log(family.indexOf("a"));
// console.log(family.lastIndexOf("a"));
// number
// let a = 125;
// const b = 125;
//****** */ typeof 5; // number
// math operators number
// console.log(a + b);
// console.log(a - b);
// console.log(a * b);
// console.log(a / b);
// console.log(a % b); // باقی مانده
// console.log(a ** b); // توان
// console.log(a++); // na hamun lahze
// console.log(++a); // hamun lahze
// console.log((a += 1)); // hamun lahze
// console.log((a *= 1)); // hamun lahze
// console.log((a /= 1)); // hamun lahze
// console.log((a -= 1)); // hamun lahze
// console.log(a--);// na hamun lahze
// console.log(--a);// hamun lahze
// let a = 125;
// console.log(++a); //126
// console.log(a++); //126
// console.log(a++); //127
// console.log(++a); //129
// console.log(++a); //130
// console.log(a); //?
// let b = 130;
// console.log(++b); // 131
// console.log(b++); // 131
// console.log(b--); // 132
// console.log(++b); // 132
// console.log(--b); // 131
// console.log(b); //?// 131
// methods
// console.log(a.toString());
// console.log(a.valueOf());
// boolean
// true false
// const isActive = true;
// const isLoggedIn = false;
// undefiend
// const x = undefined;
// ***** console.log(typeof x); // undefined
// null
// مقدار ندارد ولی وجود دارد
// typeof
// number => number
// string =>string
// number => number
// boolean => boolean
// undefined => undefined
// null => object5
// NaN => number
// function => function
// {} => object
// [] => object
// class => function
// symbol
// const x = Symbol("test");
// const y = Symbol("test");
// console.log(x == y);
// Assignment
// Compare
// Assignment Operators
// console.log((a += 1)); // hamun lahze
// console.log((a *= 1)); // hamun lahze
// console.log((a /= 1)); // hamun lahze
// console.log((a -= 1)); // hamun lahze
// console.log(x=y);
// Compare Assigntment Numbers
// console.log(2 > 10)
// console.log(2 < 10)
// console.log(2 >= 10)
// console.log(2 <= 10)
// == === Equality Compare (Jome)
// Shift Assignment(Jome)
// Logical Assignment(Jome)
// condition operators (Jome)
// && ||
// cast (Jome)
// coresion (Jome)
// 2.2 NONE PREMETIVE (Jome)
### mashgh
#### 2 روش دیگر متغیر
#### خواندن اسکوپ از روی mdn
#### خواندن اسکوپ از روی variable
#### حفظ کردن ویژگی های آنان
#### تمرین تمامی متد های استرینگ روی اسم و فامیلتون
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment