🚀 For Source Code & Home Assignment 👉 thapatechnical.shop/courses/typescript-crash-course 😊 Become Member, get access to perks, free Source code, & more.. ruclips.net/channel/UCwfaAHy4zQUb2APNOGXUCCAjoin 😍 Check my Instagram to Connect with me: instagram.com/thapatechnical 👩💻 Discord Server Link for Programmer to Hangout: discord.gg/MdScmCsua6
Bhai app legend hoo kya padhatee hoo, matlab samaj mei bhi aajata haii bore bhi nhi hotaa,,, ekdum unique u are the best youtuber......conecpts sikhte bhi hoo aur entertainment bhi karte hoo please keep making such awesome videos
Mereko lgta h union or Intersection me thoda bahut gadbad h union kehta h ki tum multi types me se kisi ek hi type ko use kr sakte ho jabki intersection me aap dono types ko include kr sakte ho For example type Cat = { meow: () => void } type Dog = { bark: () => void; } // For union type Pet = Dog | Cat; // For Intersection type Pet1 = Dog & Cat; Ab Union me hum ya to Cat type ko use kr sakte h ya fhir Dog ko Agae Catcor Dog dono ki properties ko use krna h to hume Intersection ko select krna pdega
Ye intersection kam or AND or OR Logical Operation jyada lg rhe hai jahaan Union ka kaam OR Logical Operator kr rha h or Intersection ka kaam AND Logical Operator kr rha h or dono ke symbols bhi same h bas yahaan single | or & use ho rhe h
let userInput = (value: number | string | boolean): number | string => { if(typeof value === "number") { return '$' + value + '.00'; } else if (typeof value === 'string') {
@@subhomoypal7982 abhi v error h uppercase wale line me main.ts(9,22): error TS2339: Property 'charAt' does not exist on type 'string | number | boolean'. Property 'charAt' does not exist on type 'number'. main.ts(9,54): error TS2339: Property 'slice' does not exist on type 'string | number | boolean'. Property 'slice' does not exist on type 'number'.
🚀 For Source Code & Home Assignment 👉 thapatechnical.shop/courses/typescript-crash-course
😊 Become Member, get access to perks, free Source code, & more..
ruclips.net/channel/UCwfaAHy4zQUb2APNOGXUCCAjoin
😍 Check my Instagram to Connect with me: instagram.com/thapatechnical
👩💻 Discord Server Link for Programmer to Hangout: discord.gg/MdScmCsua6
Sir I pay for source code ₹50 rs but I didn't get source code
Your auto prefix typescript plugin create a confusion for us.
Exactly
Ekdum khatarnak samjh aagya😊😊❤🎉
Bhai app legend hoo kya padhatee hoo, matlab samaj mei bhi aajata haii bore bhi nhi hotaa,,, ekdum unique u are the best youtuber......conecpts sikhte bhi hoo aur entertainment bhi karte hoo please keep making such awesome videos
Bhaiya mern stack application azure par kaise deploy karna uspar video please
Thanks a lot
Mereko lgta h union or Intersection me thoda bahut gadbad h union kehta h ki tum multi types me se kisi ek hi type ko use kr sakte ho jabki intersection me aap dono types ko include kr sakte ho
For example
type Cat = {
meow: () => void
}
type Dog = {
bark: () => void;
}
// For union
type Pet = Dog | Cat;
// For Intersection
type Pet1 = Dog & Cat;
Ab Union me hum ya to Cat type ko use kr sakte h ya fhir Dog ko
Agae Catcor Dog dono ki properties ko use krna h to hume Intersection ko select krna pdega
return (type of value === "number") ? ('$' + value. to Fixed(2)) : (type of value === "string") ? (value[0].to Upper Case() + value. slice(1)): (value === true ? "Yes" : "No");
Good 👍
Ye intersection kam or AND or OR Logical Operation jyada lg rhe hai jahaan Union ka kaam OR Logical Operator kr rha h or Intersection ka kaam AND Logical Operator kr rha h or dono ke symbols bhi same h bas yahaan single | or & use ho rhe h
ye arrow function k time 2 times Q ata voide , userInput : () => voide = () : voide => {} ? ye structor samaz nai aya
Extension Name?
Devknus for reactjs
assignment wale pdf se kuchh copy nhi ho raha hai
extension?
Dekh raha hai ha vinod 😁😁😁😁
💙💜
const inputValue = (value: string | boolean | number) => {
if (typeof value === 'number') {
return "$" + value.toFixed(2)
} else if (typeof value === 'boolean') {
if (value === true) {
return "Yes"
} else {
return "No"
}
} else if (typeof value === 'string') {
return `${value.charAt(0).toUpperCase()}${value.substring(1)}`
} else {
throw new Error("Invalid input data");
}
}
console.log(inputValue(3.143527))
console.log(inputValue("typescript"))
console.log(inputValue(false))
union task:
const formatUserInput = (input: string | number | boolean): string | number | boolean => {
if(typeof input == "string"){
return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase()
}else if(typeof input == "boolean"){
return input ? "yes" : "no"
}else if(typeof input == "number"){
return `$${input.toFixed(2)}`
}else{
throw new Error("Invalid input")
}
}
console.log(formatUserInput("hello world"))
console.log(formatUserInput(true))
console.log(formatUserInput(100))
🆃🅷🅰🅽🅺 🆈🅾🆄 🆂🅾 🅼🆄🅲🅷 🆂🅸🆁.👑👑👑👑👑👑
🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
let userInput = (value: number | string | boolean): number | string => {
if(typeof value === "number") {
return '$' + value + '.00';
}
else if (typeof value === 'string') {
return value.charAt(0).toUpperCase() + value.slice(1);
}
else {
return value=== true ? "Yes" : "No"
}
}
console.log(userInput(20));
console.log(userInput('gufran'));
console.log(userInput(true));
const booleanFn_1 = (value: string | boolean | number): void => {
switch (typeof value) {
case 'string':
value = value.charAt(0).toUpperCase() + value.slice(1)
console.log(value);
break;
case 'number':
value = `$${value.toFixed(2)}`
console.log( value);
break;
case 'boolean':
value === true ? console.log('Yes') : console.log('No')
break
default:
console.log( value, 'No worries');
}
}
booleanFn_1(15);
booleanFn_1(true);
booleanFn_1(false);
booleanFn_1('venom');
const formatFunction = (value:number|boolean|string):string =>{
if(typeof value==="number")
{
return `$ ${value/100}`;
}
return (typeof value==="boolean" && value==true) ? "Yes" : "No";
/*if(typeof value==="string")
{
return value.charAt(0).toUppercase() + value.slice(1);
}*/
}
console.log(formatFunction(856));
console.log(formatFunction(true));
//console.log(formatFunction("manjeet"));
Isme commented part me error h plz fix..
.toUppercase() asa nahi ha, asa hoga .toUpperCase()
@@subhomoypal7982 abhi v error h uppercase wale line me
main.ts(9,22): error TS2339: Property 'charAt' does not exist on type 'string | number | boolean'.
Property 'charAt' does not exist on type 'number'.
main.ts(9,54): error TS2339: Property 'slice' does not exist on type 'string | number | boolean'.
Property 'slice' does not exist on type 'number'.
@@subhomoypal7982 uppercase correct krne k baad v error h
its toUpperCase() camel case hai naa
@@adithyang6672 ha usme v error aa rha h