⚡ JavaScript & TypeScript Daily Refresher #70 👉 How do you convert a string to a number in JavaScript/TypeScript? 💡 There are many ways — Number(), parseInt(), parseFloat() — but I personally prefer the unary plus (+) operator: +value is short and clean! ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #CodingTips #WebDevelopment
Majid Abbasi’s Post
More Relevant Posts
-
⚡ JavaScript & TypeScript Daily Refresher #64 👉 What happens to default parameter values after TypeScript compiles to JavaScript? 💡 TypeScript converts them into plain JS checks. It adds an if statement to see if the argument is undefined, and if so, assigns the default value — ensuring consistent behavior at runtime. ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #Compilation #WebDevelopment
To view or add a comment, sign in
-
⚡ JavaScript & TypeScript Daily Refresher #77 👉 What is the return type of a setter function in TypeScript? 💡 Setter functions should not have a return type at all — they’re meant only to update a property’s value, not return anything. ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #OOP #WebDevelopment
To view or add a comment, sign in
-
⚡ JavaScript & TypeScript Daily Refresher #62 👉 When do you use export default and when export in TypeScript? 💡 Use export for named exports when a file contains multiple items. Use export default for a single main value — like React components or utility modules with one primary function. ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #React #WebDevelopment
To view or add a comment, sign in
-
⚡ JavaScript & TypeScript Daily Refresher #75 👉 How are classes different in TypeScript and JavaScript? 💡 They work the same at runtime — both compile to JavaScript classes. But TypeScript adds type checking, access modifiers, and interfaces, making class-based development more structured and safer. ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #OOP #WebDevelopment
To view or add a comment, sign in
-
⚡ JavaScript & TypeScript Daily Refresher #85 👉 What is a predicate in TypeScript? 💡 A predicate is a special return type used in custom type guards — it tells TypeScript that a function checks a specific type. Example: function isString(value: unknown): value is string { return typeof value === "string"; } ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #TypeGuards #WebDevelopment
To view or add a comment, sign in
-
⚡ JavaScript & TypeScript Daily Refresher #86 👉 I have a type that’s a union of multiple types — what’s the side effect of using it? 💡 Unions can cause more complex narrowing because TypeScript must consider all possible types, which can lead to extra checks before accessing properties or calling methods. ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #TypeNarrowing #WebDevelopment
To view or add a comment, sign in
-
⚡ JavaScript & TypeScript Daily Refresher #73 👉 I have a User type where all properties are required, but for a patch operation, I want to make all properties optional except id. How would you do this? 💡 Use utility types — Partial<User> makes all properties optional, and you can combine it with Pick or & to keep id required: type PatchUser = Partial<User> & Pick<User, "id"> ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #UtilityTypes #WebDevelopment
To view or add a comment, sign in
-
🚀 JavaScript — The Non-Blocking Magic! Ever wondered how JavaScript, being single-threaded, handles multiple tasks without freezing your screen? 🤔 #JavaScript #WebDevelopment #AsyncProgramming
To view or add a comment, sign in
-
⚡ JavaScript & TypeScript Daily Refresher #84 👉 What are type guards in TypeScript? 💡 Type guards are runtime checks that let TypeScript know more about a variable’s type within a block — for example: if (typeof value === "string") { /* value is a string here */ } ✨ I post daily JS/TS refreshers — follow for the next one! #JavaScript #TypeScript #TypeGuards #WebDevelopment
To view or add a comment, sign in
-
📒 JavaScript Handwritten Notes — Master the fundamentals with clarity and practice! 💻✍️ Perfect for beginners and developers brushing up their JS concepts. #JavaScript #FrontendDevelopment #WebDevelopment #CodingCommunity #DeveloperNotes #HandwrittenNotes #Hanubytes #TechLearning #CodeWithMe #JSBasics
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development