Datatype conversion confusion | chai aur #javascript

Chai aur Code
30 Dec 202212:50

Summary

TLDRThe video script is part of a JavaScript series focusing on data type conversions, a fundamental concept in programming. It discusses the importance of understanding variable types, such as numbers and strings, and the potential issues that can arise from incorrect conversions. The instructor emphasizes the need for practice to gain proficiency and confidence in handling these conversions, ensuring that viewers will not need to revisit the topic multiple times. The script promises a comprehensive series that will save time and provide quality content, covering topics like functions and indexing in depth.

Takeaways

  • 😀 The video is part of a JavaScript series aimed at building confidence in programming concepts by revisiting important topics multiple times.
  • 📚 The series will cover topics that are fundamental and will be revisited to ensure thorough understanding, avoiding the need for multiple revisions.
  • 💻 The importance of practice is emphasized, suggesting that the more one practices, the more comfortable they will become with JavaScript.
  • 🔢 Discussions on functions will be included, with the assurance that they will not be brushed over or only touched upon briefly.
  • 🔄 The script delves into the concept of data type conversion, or 'type coercion', in JavaScript, explaining how different data types can be converted.
  • 📝 It highlights the need to understand the 'type' of a variable, especially when dealing with values that may come in different formats such as strings or numbers.
  • 🎲 The script uses examples like game scores to illustrate the concept of variable declaration and the importance of knowing the underlying data type.
  • 🛠️ It explains the process of converting data types using JavaScript, including the use of methods and the examination of output to understand the conversion result.
  • 👀 The video emphasizes careful value checking when performing type conversions, as the actual data type might not be immediately apparent.
  • 📉 The script mentions potential issues with relying on numbers within JavaScript, as type coercion can lead to unexpected results.
  • 🔮 The importance of understanding how values are converted, especially when they are not defined or when they are boolean, is discussed to avoid confusion.

Q & A

  • What is the main focus of the video series mentioned in the script?

    -The main focus of the video series is to delve deeper into JavaScript concepts, with an emphasis on topics that are not covered multiple times, aiming to build confidence among the viewers.

  • What is the importance of practice mentioned in the video script?

    -The importance of practice is highlighted to become comfortable with JavaScript, suggesting that a little common sense and more practice will make viewers confident in handling the language.

  • What is the significance of understanding the type of a variable in JavaScript as discussed in the script?

    -Understanding the type of a variable is significant because it dictates how values are interpreted and manipulated in JavaScript, which is crucial for correct programming and avoiding type-related errors.

  • Why is it necessary to be cautious when dealing with values received from a front-end request in the script?

    -It is necessary to be cautious because the values received might not always be in the expected format, such as a number, and could be a string or even an object, which requires proper handling to avoid errors.

  • What is the concept of type conversion in JavaScript as alluded to in the script?

    -Type conversion in JavaScript refers to the process where a value of one type is treated or transformed to another type, which is a common operation in programming to ensure compatibility and correct execution of operations.

  • Why is it mentioned that relying solely on numbers in JavaScript might lead to problems?

    -Relying solely on numbers might lead to problems because JavaScript is loosely typed, and operations that assume a numeric value might unexpectedly receive a string or boolean, leading to type coercion issues.

  • What does the script suggest about the relationship between the value '33' and its type?

    -The script suggests that even though '33' is a number, it could be received as a string or in another format, and understanding its actual type is essential before performing operations on it.

  • How does the script address the issue of undefined values in JavaScript?

    -The script addresses undefined values by suggesting that if a variable is declared with an undefined value, it should be handled carefully to ensure that the program does not encounter errors due to unexpected types.

  • What is the significance of the 'value' keyword in the context of the script?

    -The 'value' keyword in the script is used to refer to the data that is being manipulated or checked for its type, emphasizing the importance of understanding the actual data type before performing operations.

  • What does the script imply about the conversion of boolean values to numbers in JavaScript?

    -The script implies that boolean values can be converted to numbers in JavaScript, with 'true' converting to 1 and 'false' converting to 0, which is a type of type coercion that developers should be aware of.

  • What is the final takeaway from the script regarding handling data types in JavaScript?

    -The final takeaway is the importance of being vigilant about the types of values being handled in JavaScript, understanding that type conversion is a common occurrence, and being prepared to manage different data types effectively.

Outlines

00:00

🔍 Deep Dive into JavaScript Series

In this introductory segment, the speaker sets the stage for an in-depth exploration of JavaScript topics. The series aims to build confidence in the learners by revisiting key concepts multiple times to reinforce understanding. The emphasis is on practice and repetition, ensuring that even challenging topics become manageable. The speaker highlights that the series will cover topics like functions in multiple layers, revisiting them for a deeper understanding and ensuring comprehensive coverage of JavaScript.

05:00

💡 Understanding Data Type Conversion in JavaScript

This section dives into the intricacies of data type conversions in JavaScript, using variables like 'score' to illustrate the process. The speaker discusses how different values, such as strings and numbers, might be received and the importance of knowing the type of data being handled. The speaker explains how JavaScript handles type conversion, particularly when dealing with numbers, strings, and objects. They demonstrate how to use methods like 'typeof' to check data types and the potential pitfalls when converting values, such as inadvertently converting strings to numbers.

10:02

🕵️‍♂️ Investigating JavaScript's Conversion Quirks

This paragraph continues the exploration of data type conversions by delving into more complex scenarios, such as what happens when null or undefined values are converted. The speaker highlights potential issues, such as how null converts to zero and how undefined can result in NaN (Not a Number). They also discuss boolean conversions, showing how values like 'true' and 'false' behave when converted to numbers. The speaker stresses the importance of being cautious when relying on JavaScript's type conversions due to these quirks.

Mindmap

Keywords

💡JavaScript

JavaScript is a high-level, interpreted programming language commonly used for enhancing web pages with interactive elements. In the video script, it is the main theme, as the speaker discusses various concepts related to JavaScript programming, aiming to build confidence among the viewers in understanding and using the language.

💡Series

The term 'series' refers to a number of things or events standing or succeeding in order, or a television or radio program that has the same characters or theme. In this context, the speaker is referring to a series of educational videos on JavaScript, indicating a progression of topics that will be covered to enhance the viewers' knowledge.

💡Confidence

Confidence in this script refers to the speaker's intention to instill a sense of certainty and belief in the viewers' abilities to understand and apply JavaScript concepts. It is a key aspect of the video's educational goal, as the speaker aims to make complex topics more approachable.

💡Practice

Practice is the action of doing something repeatedly to improve one's skill in it. In the script, the speaker emphasizes the importance of practice in learning JavaScript, suggesting that viewers should engage in common sense and apply the concepts they learn through repeated exercises to become proficient.

💡Variables

Variables are used in programming to store data values. The script mentions variable declaration, which is a fundamental concept in JavaScript where the speaker discusses how to define and use variables within the code, such as 'score', to hold and manipulate data.

💡Type

In programming, 'type' refers to the classification of data, such as 'number', 'string', or 'boolean'. The script discusses the importance of understanding the type of a variable, like determining if a 'score' is a number or a string, which is crucial for correct data manipulation and function execution.

💡Conversion

Conversion in the context of the script means changing data from one type to another, such as converting a string to a number. The speaker explores the concept of type conversion in JavaScript, explaining how to ensure that data is in the correct format for operations, which is a common task in programming.

💡Boolean

A Boolean is a data type that has only two possible values: 'true' or 'false'. In the script, the speaker mentions Boolean values in the context of conversion, explaining how certain values or expressions are treated as Booleans and how they convert to true or false in JavaScript.

💡Undefined

In JavaScript, 'undefined' is a value that represents the absence of a value. The script discusses 'undefined' in the context of variables that have not been assigned a value yet, which is an important concept to understand when debugging or working with variable states in code.

💡Investigation

Investigation in the script refers to the speaker's approach to exploring and explaining JavaScript concepts in depth. It is used to describe the process of examining how certain programming behaviors work, such as the conversion of data types, to provide a clear understanding to the viewers.

💡Syntax

Syntax refers to the set of rules governing the structure of expressions in programming. The script mentions syntax in the context of writing correct JavaScript code, emphasizing the importance of following the proper structure when performing operations or conversions to avoid errors.

Highlights

Introduction to a new video in the JavaScript series, emphasizing the importance of revisiting topics for confidence.

Discussion on the necessity of practice to become comfortable with JavaScript concepts.

Explanation of the importance of understanding data types when declaring variables in JavaScript.

Clarification on the difference between a value being a string or a number and its implications for coding.

The concept of type conversion in JavaScript and its significance in coding.

How to handle different data formats and the guarantee of data type when coding.

The use of typeof operator to determine the type of a variable in JavaScript.

Demonstration of converting a string to a number and the potential issues that may arise.

The exploration of converting boolean values to numbers and the expected outcomes.

Investigation into the behavior of JavaScript when converting various data types.

The impact of undefined values on type conversion and coding practices.

Understanding the conversion of null values and their outcomes in JavaScript.

The process of converting objects to primitive values in JavaScript.

Discussion on the conversion of special values like NaN and their handling in code.

The importance of careful value checking during type conversion to avoid confusion.

Summary of the basic concepts of type conversion covered in the video.

Invitation to the audience to subscribe and share the series for motivation and support.

Transcripts

play00:00

हान जी स्वागत है आप सभी का चाय और कोर्ट

play00:02

के एक और वीडियो में शुरू करते हैं हमारी

play00:04

जावास्क्रिप्ट सीरीज को और आगे लेकर जाते

play00:06

हैं अब इस सीरीज के अंदर क्या है की कुछ

play00:09

ऐसे टॉपिक्स होंगे जिनको हम एक बार नहीं

play00:11

दो बार नहीं तीन या चार बार पढ़ेंगे

play00:13

क्योंकि गोल अभी भी वही है इस सीरीज के

play00:16

थ्रू मैं आप में कॉन्फिडेंस लाना चाहता

play00:17

हूं ये बता के जाओ स्कर्ट इतनी भी परिसर

play00:20

नहीं है अगर थोड़ा सा कॉमन सेंस उसे करें

play00:22

थोड़ा सा प्रैक्टिस करें थोड़ा और ज्यादा

play00:24

प्रैक्टिस करें तो इजीली आप इसके साथ

play00:26

कंफर्टेबल हो जाएंगे तो कुछ इस सीरीज के

play00:29

दौरान हम जैसे फंक्शंस के बारे में बात

play00:31

करेंगे तो ऐसा नहीं होगा की एक बार

play00:32

फंक्शंस के बारे में बात कर ले दोबारा कभी

play00:33

टच ही नहीं करेंगे दोबारा से रिवीजन में

play00:36

फंक्शंस आएंगे उसको फिर और इंडेक्स में

play00:37

जाएंगे तो इस ऐसा मत sochiyega की एक

play00:40

टॉपिक हो गया है तो आप दोबारा कभी आएगा ही

play00:41

नहीं और आपने ये चीज तो कवर ही नहीं कारी

play00:43

सब कवर करेंगे टाइम जरूर लगेगा लेकिन

play00:46

इंटरनेट की बेस्ट सीरीज बनानी है तो वक्त

play00:48

तो लगेगा क्वालिटी में टाइम लगता है तो

play00:50

यहां पर एक और नया वीडियो है हमारे पास जो

play00:52

की एक कन्वर्शन और ऑपरेशंस चावल के अंदर

play00:55

कन्वर्जन जो है वो एक बहुत ही बड़ा नाइट

play00:58

में टॉपिक है ऐवेंंचुअली हम दो इसके बारे

play01:00

में बात करेंगे तो आपको पता लगेगा की

play01:02

क्यों ऐसा प्रॉब्लम आता है अब यहां पे हम

play01:05

कुछ वेरिएबल डिक्लेयर करते हैं अब वेरिएबल

play01:07

डिक्लेयर करना तो ए ही गया है तो इसका हम

play01:09

थोड़ा सा एडवांटेज लेते हैं तो हमने क्या

play01:12

कर यहां पे बोला लेट आगे तो आगे एक

play01:14

वेरिएबल है या फिर हम किसी का स्कोर ले

play01:16

लेते हैं क्योंकि यूजुअली मेरा फेवरेट

play01:18

वेरिएबल होता है तो हमने कहा की स्कोर है

play01:20

33 सपोस मारियो गेम खेल रहे हैं कॉन्ट्रा

play01:22

खेल रहे हैं या आजकल के पोकेमोन गेम खेल

play01:25

रहे हैं अब आपको सबसे पहले पता करना है

play01:27

इसका टाइप अब टाइप क्यों पता करना है हमें

play01:29

तो पता है ये नंबर है लेकिन कई बार क्या

play01:31

होता है आप वसंत पे कम कर रहे हैं फ्रंट

play01:33

एंड पे जिसने ये कम पूरा किया है उसने

play01:36

आपको वैल्यू तो सेंड करिए बट वो वैल्यू

play01:38

किसी फॉर्म से आई है हो सकता है ये वैल्यू

play01:40

जो स्कोर है इसके अंदर वैल्यूज स्ट्रिंग

play01:42

के अंदर हो नंबर हो ही ना या फिर हो सकता

play01:44

है वैल्यू किसी और फॉर्मेट में ऑब्जेक्ट

play01:46

में हो तो आपके पास कोई गारंटी नहीं है

play01:48

यहां पे आप लिख रहे हैं तो गारंटी है की

play01:50

33 है बट कई बार आपको पता ही नहीं होता

play01:52

वैल्यू कहां से ए रही है जैसे की आप

play01:54

देखेंगे कई बार क्या होता है हम फ्रंट एंड

play01:56

रिक्वेस्ट से लेते हैं तो आपने लिखा

play01:57

रिक्वेस्ट बॉडी

play01:59

रिक्वेस्ट

play02:01

बॉडी और यहां से आपके पास वैल्यू ए गया

play02:04

स्कोर तो आप उसको नाम देते हैं और इस तरह

play02:06

से आप वैल्यू लेते स्कोर तो लाइन नंबर वैन

play02:10

के अंदर तो आपको पता है की आपने 100%

play02:13

स्कोर को एक नंबर लिया लेकिन लाइन नंबर

play02:14

थ्री में कोई गारंटी नहीं है की ये वैल्यू

play02:16

स्ट्रिंग आई है या फिर नंबर आया है या

play02:19

क्या कुछ और आया है तो अभी हमें नहीं पता

play02:22

है तो अब हम क्या करते हैं एक कंसों लोग

play02:24

लिखते हैं और हमें पता है की ऑलरेडी दो

play02:26

तरीके हैं जैसे हमने कहा टाइप ऑफ इस तरह

play02:29

से भी आप किसी का देख सकते हैं जैसे स्कोर

play02:32

और एक तरीका और है की आप लिख सकते हैं

play02:34

इसको ऐसे मेथड यानी की पहले थीसिस के अंदर

play02:38

तो ये भी से है जैसे आप चाहे जो भी आप

play02:41

चाहे तो ये रहा तो इसका आउटपुट देखते हैं

play02:44

की आउटपुट क्या आता है

play02:46

है तो हमने कहा नोट

play02:49

01 फोल्डर के अंदर एक जीरो थ्री फाइल है

play02:51

थर्ड फाइल ए गई है उसको करो तो इसने कहा

play02:54

दोनों में नंबर अब गौर कीजिएगा की नंबर

play02:56

दोनों लोअर केस में लिखा हुआ है ठीक है

play02:58

लेकिन अगर सपोस करिए ये जो 33 है यह कुछ

play03:03

इस तरह से लिखा होता तो अभी 33 क्या है

play03:06

डबल कोट्स के अंदर ए गया है तो मतलब ये

play03:07

स्ट्रिंग बन गया है अब मैं इसको से करता

play03:09

हूं तो obbvious सी बात है बोल रहा है

play03:11

स्ट्रिंग अब सपोस करिए आपके पास स्ट्रिंग

play03:14

में वैल्यू आई है आपको पता है की मुझे

play03:15

100% जो ऑपरेशन करना है वो नंबर्स पे करना

play03:18

है तो आप क्या कर सकते हैं एक और नया

play03:21

वेरिएबल डिक्लेयर कर सकते हैं हम यहां पर

play03:24

लिख सकते हैं वैल्यू इन नंबर

play03:28

है तो हम लिख देंगे यहां पर अभी 33 अब

play03:30

कैसे लिखना है अब यहां पर जो आप नंबर उसे

play03:33

करते वह कैपिटल उसे करते हैं जितने भी

play03:35

डाटा टाइप मैंने आपको पढ़ाया हैं जितने भी

play03:37

तो नहीं बट हम मेजर्ली जो है और भी आपको

play03:39

पता लग जाएंगे उनका इस तरह से कैपिटल

play03:41

फॉर्मेट होता है ये क्लास बेस्ड है आगे

play03:44

जाकर हम देखेंगे अभी इतना ध्यान रखिए की

play03:46

आप स्ट्रिंग को भी इस तरह से उसे कर सकते

play03:48

हैं नंबर्स को भी कर सकते हैं अब जैसे

play03:50

आपने नंबर लिखा उसके बाद आप इसके अंदर

play03:52

स्कोर पास कर दीजिए आप स्कोर हमने पास कर

play03:54

दिया है तो ये गारंटी है ये जो स्कोर है

play03:58

अब वो नंबर में कन्वर्ट हो गया है तो मैं

play04:01

इसको यहां पे कॉपी कर लेता हूं इस लाइन को

play04:03

और यहां पे पेस्ट करता हूं अब ये लाइन हो

play04:06

गई है मेरे पास यहां पे पेस्ट अब मैं क्या

play04:08

करता हूं इसका मुझे इस बार वैल्यू जानना

play04:10

है की जो

play04:13

वैल्यू इन नंबर है

play04:17

इसका टाइप क्या है तो से करते हैं और

play04:19

देखते हैं वापस से तो मैंने देखा की इसका

play04:21

जो टाइप है वह नंबर है अब यहां से होती है

play04:24

कहानी शुरू की आपने कोई भी वैल्यू दी और

play04:27

उसको बोला की ठीक है आप उसको कन्वर्ट कर

play04:28

दो नंबर में तो नंबर में कन्वर्ट हो गई पर

play04:31

क्या गारंटी है की वो 33 ही आएगा हो सकता

play04:34

है 33 ए बी सी किसी ने टाइप किया हो या

play04:37

फिर यही वैल्यू ए रही हो तो क्या ये

play04:39

कन्वर्ट होगा तो इस तरह से आप डालते हैं

play04:41

इसको से करेंगे और इसको हम वापस से रन

play04:43

करके देखते हैं तो हमें वापस से नंबर मिल

play04:45

गया ये कैसे हुआ अब 33 एबीसी क्या वो नंबर

play04:49

में कन्वर्ट होना चाहिए था बिल्कुल नहीं

play04:51

होना चाहिए था तो एक्चुअली में वैल्यू

play04:53

नंबर के अंदर है क्या इसको भी हम प्रिंट

play04:55

कर कर देखते हैं की हम इसको प्रिंट करते

play04:58

हैं की एक्चुअली में नंबर क्या आया है

play05:00

क्योंकि यही तो कन्फ्यूजन दूर करेगा हमारी

play05:02

इन्वेस्टिगेशन स्टडी का तो मैं यहां पर

play05:04

देख रहा हूं की ठीक

play05:06

पर यह नंबर तो नहीं

play05:08

नंबर यह जो नंबर है तो इसका जब भी आप

play05:12

वैल्यू चेक करें तो बहुत ध्यान से करें

play05:14

क्योंकि कई बार आपके साथ ऐसा होगा की ये

play05:17

जो 33 एबीसी है जो की पूरे नंबर नहीं है

play05:19

इसको जवाब कन्वर्ट करेंगे तो वो कन्वर्ट

play05:21

हो जाएगा

play05:22

और जब आप एक्चुअली में वैल्यू देखेंगे तो

play05:25

वो ना है तो नैनो भी एक स्पेशल टाइप है

play05:28

जिसको आप चेक कर सकते हैं की क्या वैल्यू

play05:30

ने ये तो नहीं दिया है ठीक है तो इस तरह

play05:32

से प्लीज ध्यान रखिएगा की आप नंबर्स पर

play05:35

रिलायंस ना करें जावास्क्रिप्ट के अंदर

play05:37

थोड़ी सी प्रॉब्लम है थोड़े से शूज हैं

play05:39

स्ट्रिक्ट चेक नहीं है इसलिए तो टाइप

play05:40

सिर्फ बहुत सारे लोग उसे करते हैं बट ऐसा

play05:42

नहीं है की लैंग्वेज का कोई खराब फीचर है

play05:44

या उसका कोई बाग है इसने उसको कन्वर्ट

play05:46

करने की कोशिश कारी आगे जाके

play05:48

डॉक्यूमेंटेशन में आपको बताऊंगा किस तरह

play05:49

से कन्वर्जन होता है किस तरह से कंबाइंड

play05:52

होती है वैल्यू बट ये ध्यान रखें क्योंकि

play05:54

हमने इन्वेस्टिगेशन स्टडी की है तो हमें

play05:56

पता लग गया है की ठीक है इस तरह के भी

play05:58

केसेस आते हैं जब आपकी वैल्यूज कन्वर्ट

play05:59

होती है कई बार नहीं होती है अच्छा अगर ये

play06:02

तो बात हो गई स्कोर की अगर सपोज करिए

play06:04

हमारे इसके अंदर वैल्यू नल तब क्या होता

play06:08

तो यह हम देख लेते हैं क्योंकि हमने

play06:10

इन्वेस्टिगेशन स्टडीज करनी है तो यह देखा

play06:12

तो देखिए नल का वैल्यू क्या है इसने

play06:15

कन्वर्ट कर दिया जीरो अब हो सकता है जीरो

play06:17

से अपना टेंपरेचर मैच कर रहे हो ध्यान

play06:19

रखिएगा कई बार जब कन्वर्ट नहीं हो पता है

play06:22

तो अन्य नबी हमने देखा और जीरो भी देखा नल

play06:25

के केस में अब इसके बाद एक और बच्चा है

play06:27

उसको भी देख ही लेते हैं की हमारे पास

play06:29

वैल्यू है उन डिफाइंड अगर आप अनडिफाइंड

play06:31

वैल्यू लिख देते हैं तो वापस से आपके पास

play06:33

ना ए गया तो ठीक है तो हमने कुछ जाना इसके

play06:36

थ्रू अच्छा एक और चीज है यहां पे अगर कोई

play06:39

बुलियन वैल्यू आपने लिख दी है ट्रू तब

play06:42

क्या आएगा तो आप ऐसी बात है ये भी हम

play06:43

जानना चाहेंगे तो हमने देखा की वैन आता है

play06:46

तो obbvious सी बात है अगर फॉल्स होती तो

play06:48

जीरो आता और अगर कोई स्ट्रिंग है जो की

play06:51

कन्वर्ट नहीं हो सकती जैसे की सपोर्ट करिए

play06:53

हितेश है और ऐसी बात है की किसी नंबर में

play06:55

कन्वर्ट नहीं हो सकता तो यहां पर आपको

play06:58

वापस से मिल जाएगा तो जब भी आप कुछ

play07:00

कन्वर्जन करें इस तरह का तो ध्यान रखिएगा

play07:02

क्या क्या कन्वर्जन में ए सकता है अब हम

play07:04

कुछ नोट्स तो यहां पे लिख ही सकते हैं

play07:06

सबसे पहले हमने देखा की जब आप एक नंबर को

play07:08

कन्वर्ट करते हैं 33 को तो वह इजीली

play07:12

कन्वर्ट हो जाता है 33 में लेकिन उसके बाद

play07:14

हमने देखा की जैसे हमने देखा की 33 कुछ ए

play07:17

बी सी है तो ये कन्वर्ट नहीं हो का रहा है

play07:19

तो इस तरह के नंबर्स हमें वैल्यू देते हैं

play07:21

ना जिसका शॉर्ट फॉर्म है मतलब लॉन्ग फॉर्म

play07:24

है नॉट एन नंबर तो प्लीज ध्यान रखिएगा बट

play07:27

इसका जो टाइप है

play07:29

ये थोड़ा सा कन्ज्यूरिंग है इसके बाद हमने

play07:31

देखा की अगर हम वैल्यूज लेते हैं कुछ इस

play07:34

तरह की ट्रू तो वो कन्वर्ट हो जाती है वैन

play07:38

के अंदर तो obbvious सी बात है की हमारे

play07:40

जो फॉल्स वैल्यू है वो कन्वर्ट हो जाती है

play07:41

जीरो के अंदर और इसके अलावा भी आपने सब

play07:44

देख ही लिया है की किस तरह से कन्वर्जन

play07:45

होता है तो ये तो हुआ हमारा बेसिक

play07:47

कन्वर्जन अच्छा इसके अलावा इसी तरह से

play07:50

हमारे पास और भी थोड़ा सा कन्वर्जन है ये

play07:52

तो हमारे नोट्स हो गए तो सपोर्ट करिए और

play07:54

हम कन्वर्जन करते हैं तो इस लोग इन तो ये

play07:58

हमारी जो वैल्यू है ये है सपोज करिए हम

play08:01

इसको वैल्यू को दे रहे हैं की किसी तरह से

play08:04

मुझे इस वैल्यू को कन्वर्ट करना है

play08:05

बोलियां

play08:06

है तो obbvious सी बात है

play08:09

बट क्या हो अगर मैं इस लोग डैन को लिखूं

play08:12

वैन तो कन्वर्जन कैसे होगा तो एक और

play08:16

वेरिएबल डिक्लेयर करते हैं तो इसको हम लिख

play08:18

देते हैं बोलिए

play08:25

जैसे हमारे पास नंबर था जैसे हमारे पास

play08:28

स्ट्रिंग है कैपिटल में वैसे हमारे पास

play08:30

बुलियन भी है तो ये बुलियन के अंदर आप

play08:33

वैल्यूज पास कर सकते हैं इस लॉक्ड इन बट

play08:36

यह जानना बहुत जरूरी है की एक्चुअली में

play08:38

वो कन्वर्ट हुई और कन्वर्ट हुई तो क्या

play08:40

कन्वर्ट हुई तो हम इसकी वैल्यू को देखते

play08:42

हैं कॉपी करके यहां पेस्ट करते हैं और

play08:45

जानते हैं अब सबसे पहले हम क्या करेंगे इन

play08:47

वैल्यूज को जो भी है हम इनको कमेंट आउट कर

play08:49

देते हैं ताकि हमें ज्यादा आउटपुट ना

play08:52

देखना पड़े क्योंकि इन्वेस्टिगेशन स्टडी

play08:53

तो ऑलरेडी हो ही गई है तो अब सिर्फ हमें

play08:55

मतलब है इससे की जब हम नंबर्स को इस तरह

play08:58

से बोलियां कन्वर्ट करते हैं क्योंकि कई

play09:00

बार हम बोल देते हैं जीरो का मतलब फॉल्स

play09:01

वैन का मतलब ट्रू तो एक्चुअली में

play09:03

कन्वर्जन में क्या होता है

play09:07

तो इस तरह से जब आप वैन को कन्वर्ट

play09:12

पता है वैन को कन्वर्ट करेंगे ट्रू होगा

play09:14

जीरो को कन्वर्ट करेंगे फॉल्स होगा बट

play09:17

इसको कन्वर्ट करेंगे तो क्या होगा देखते

play09:20

हैं

play09:22

फॉल्स ठीक है अब इसके बाद अगर मैं इसमें

play09:25

मेरा नाम लिख देता हूं तो क्या होगा तो

play09:29

मैंने देखा तो भी ट्रू आता है और अगर मैं

play09:32

एम्टी रखता हूं तो जस्ट अभी हमने देखा की

play09:34

वैल्यू फॉल्स आती है तो इससे यह तो पता लग

play09:37

गया की जब आप कन्वर्जन करते हैं तो कुछ ना

play09:40

कुछ सिंटेक्स है जो की आगे जाकर आपको और

play09:41

पता लग जाएंगे बट उनका ध्यान रखना थोड़ा

play09:43

जरूरी है तो यहां पे हमारी इन्वेस्टिगेशन

play09:46

स्टडी ने बताया की जब आप वैन लिखते हैं तो

play09:48

obbvious सी बात है बोलियां में वो ट्रू

play09:50

कन्वर्ट होता है और इसी तरह से जीरो जब आप

play09:52

लिखते हैं तो वो फॉल्स में कन्वर्ट होता

play09:55

है

play09:57

अगर लिख पाए तो फॉल्स ठीक

play10:01

तो हमारे पास वैल्यू आई फॉल्स और जब हमने

play10:05

स्ट्रिंग के अंदर कुछ वैल्यू ऐड कर दी

play10:06

जैसे की सपोर्ट करिए तो उसका जो वैल्यू

play10:09

आया वो ट्रू आया और ये बन गया आपके नोट्स

play10:11

अब इसके लिए आप कॉपी पेन लेकर घिसने की

play10:13

जरूरत थोड़ी ना है यहीं पे सब कुछ लिख रहे

play10:15

हैं तो यहीं पे हमारे ये नोट्स हो गए यहीं

play10:17

पे हमारी इन्वेस्टिंग स्टडी हो गई और हमने

play10:19

फटाफट देखा है की कितना आसान था की जो

play10:22

कन्वर्जन है वो हमने पढ़ लिया अच्छा अब

play10:24

कन्वर्जन की बात क्या है की यहां पे खत्म

play10:26

नहीं होती है कन्वर्जन ये तो हमने देखा की

play10:28

ठीक है आपने नंबर के अंदर कन्वर्ट किया

play10:30

चीजों को आपने चीजों को बोलियां के अंदर

play10:33

कन्वर्ट कर बट चीजें स्ट्रिंग के अंदर भी

play10:35

तो कन्वर्ट हो सकती है जैसे मेरे पास सैम

play10:38

नंबर कोई नंबर है क्योंकि वैरियेबल्स नहीं

play10:42

ए रहा है दिमाग में तो सब नंबर है जिसका

play10:44

33 हमने नंबर दिया अब मुझे इसको लेट

play10:48

स्ट्रिंग नंबर

play10:51

इसको कन्वर्ट करना है तो ऐसी बातें मैं

play10:53

स्ट्रिंग को उसे कर सकता हूं और इसके अंदर

play10:55

यह सब नंबर पास कर सकता

play10:58

लॉक करके देखते हैं इसको भी की क्या

play11:00

वैल्यू आती है

play11:02

तो स्ट्रिंग नंबर से करते हैं और ओबवियस

play11:05

सी बात है इस कंसोल को हटा देते हैं ताकि

play11:07

ये प्रिंट ना हो

play11:10

से करते हैं और रन करके देखते हैं इसको तो

play11:14

मैंने देखा 33 ए गया है तो ठीक है 33 आपका

play11:17

जो नंबर था वही 33 ए गया है लेकिन असली

play11:20

में सच्चाई मुझे तब पता लगेगी की एक्चुअली

play11:22

मैं हुआ क्या है जब मैं इसका टाइप ऑफ करके

play11:25

देखता हूं की एक्चुअली मैं क्या टाइप हुआ

play11:28

है क्या सही में वो नंबर अब स्ट्रिंग बन

play11:30

गया है हान स्ट्रिंग बन गया दिखने में

play11:32

नंबर जैसा है बट बंद तो स्ट्रिंग है

play11:36

है तो इसी तरह देख सकते हैं की और

play11:38

कन्वर्जन हो सकता है अब और भी बहुत सारे

play11:40

कन्वर्जन है ऑब्जेक्ट्स के हैं यह सब हैं

play11:42

तो धीरे-धीरे हम देखेंगे और सबसे बेस्ट

play11:44

पार्ट पता है क्या है इन्वेस्टिगेशन स्टडी

play11:46

अगर आपके भी दिमाग में ए रहा है की ठीक है

play11:48

अगर इस तरह का नंबर और कन्वर्ट हो या इस

play11:50

तरह का हो ये कन्वर्जन आगे जाके और आपको

play11:52

क्लियर होंगे जैसे जैसे हम फॉर्म्स पे कम

play11:54

करेंगे जैसे सजा स्क्रिप्ट के प्रोजेक्ट्स

play11:56

बनाएंगे तब हमारे पास बहुत इजी होगा

play11:58

क्योंकि जो ब्राउज़र है वो ज्यादातर आपको

play12:00

स्ट्रिंग्स वैल्यू देता है पर आपको कई बार

play12:02

उसको बुलियन में कन्वर्ट करना होता है कभी

play12:03

नंबर में कन्वर्ट करना होता है या

play12:05

ऑब्जेक्ट में कन्वर्ट करना होता है या एरा

play12:07

में तो वो हम आगे जा के और देखेंगे अभी के

play12:09

लिए हम इतना ही करते हैं बहुत ही इसे था

play12:11

अभी हमें ऑपरेशंस के बारे में और थोड़ा सा

play12:13

डिस्कस करना है इसी के अंदर डिस्कस करेंगे

play12:15

इसी फाइल के अंदर बट अभी अत लिस्ट इसको तो

play12:18

पुश कर देते हैं तो हर फाइल के बाद हम

play12:19

इसको पुश करते हैं तो हमने यहां पे डिस्कस

play12:22

किया कन्वर्जन ऑफ

play12:25

डाटा टाइप्स के बारे में डिस्कशन हो गया

play12:28

है तो इसको हमने पुश कर दिया कमेंट कर

play12:31

देते हैं और इसको कर देते हैं

play12:35

आपके पास अवेलेबल हो तो मिलते हैं अगले

play12:38

वीडियो में याद रखिए सब्सक्राइब करना बहुत

play12:40

जरूरी और फैला दीजिए सीरीज को सबके सामने

play12:42

क्योंकि यहां पे हो रही है बेस्ट

play12:44

जावास्क्रिप्ट तो सारे फ्रेंड्स को बताना

play12:46

तो जरूरी है हमें मोटिवेशन मिलेगा मिलते

play12:49

हैं अगले वीडियो में

Rate This

5.0 / 5 (0 votes)

الوسوم ذات الصلة
JavaScriptData TypesType ConversionProgrammingCoding TutorialNumber ConversionString HandlingBoolean LogicDeveloper TipsWeb DevelopmentTech Education
هل تحتاج إلى تلخيص باللغة الإنجليزية؟