Swapna Kumar Panda ๎จ€ Profile picture
Mar 19 โ€ข 7 tweets โ€ข 2 min read
๐Ÿ’œ JavaScript: Array's length vs String's length
-
โ‡ฉ Array's length property is mutable whereas String's length p
โžŠ Introduction

In JavaScript,

โœง Array is an Object whereas String is a primitive

โœง Despite String being a primitive, for easy operations it has a lot of methods and, properties

โœง String is considered as Array-Like

โœง Both Array and, String has a "length" property
โž‹ Array's length

โœง Unlike many other languages, JavaScript actually allows to modify an array's length manually.

โœง If we set a larger length, few blank spaces (holes) are added to the end.

โœง If we set a smaller length, elements are removed from the end.
โžŒ String's length

โœง String is immutable. Hence, in no way we could modify a String.

โœง String's length property is that's why immutable.

โœง When we try to set a new length, the operation is ignored.
โž Final Words

โœง In JavaScript, Array's length property is allowed to modify manually. Either array is expanded or, truncated towards its end-side when we modify its length.

โœง In JavaScript, String is immutable and thus its length property as well. It can't be modified.
๐Ÿ’ญ Feedbacks

โœง Did you find this thread useful?
โœง After reading through entire thread, have you learnt something worth?
โœง What improvements will you suggest?

Hey ๐Ÿ‘‹. I will be happy to hear from you. Your feedbacks would help me sharing better contents in future.
End of ๐Ÿงต

Hey ๐Ÿ‘‹ I am a Tech Educator from India ๐Ÿ‡ฎ๐Ÿ‡ณ

I am sharing Tutorials, Tips, Techniques, Infographics, Cheat Sheets, Interview Questions and Roadmaps on Web Development, DSA and, Database.

Are you interested? I am sure, you are.

To never miss anything, Follow Me โœ…

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Swapna Kumar Panda ๎จ€

Swapna Kumar Panda ๎จ€ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @swapnakpanda

Mar 21
15 Useful HTML Elements for Text Contents

โ‡ฉ
๐Ÿ“‹ What shall we explore?

โžŠ abbr
โž‹ dfn
โžŒ em
โž strong
โžŽ mark
โž small
โž q
โž‘ blockquote
โž’ cite
โž“ var
โžŠโžŠ code
โžŠโž‹ kbd
โžŠโžŒ samp
โžŠโž data
โžŠโžŽ time
๐Ÿ’ญ Why is this Thread?

โ‘ In a typical web page, we render varieties of text contents. The context of few contents may vary from others.

โ’ Sometimes we may have to highlight them semantically for SEO and Accessibility purposes.

โ‘ Let's explore 15 such HTML elements.
Read 21 tweets
Mar 20
How much JavaScript is good enough to start in React?

โ‡ฉ
๐Ÿ’ญ Why is this Thread?

โฌ˜ JavaScript and React both are popular and having a large share.

โฌ— I have often seen people jumping straight to React without much knowledge in JavaScript.

โฌ™ Is this a good idea? If no, then how much JavaScript knowledge is enough to start React?
๐Ÿ‘ฉโ€๐Ÿ’ป Beginning Words

โฌ– I suggest to start learning JavaScript first.

โฌ˜ If you start with React, you would frequently travel between JavaScript and React making the learning progress slower.

โฌ— Let's see how much JavaScript should be enough to start working in React.
Read 16 tweets
Mar 18
๐Ÿ”  CSS Font Related Properties & Values
๐ŸŒ† Direct Link for High Resolution Image

If you liked this one, give a โญ๏ธ to this GitHub repo to support my work.

โœง Direct Link:
github.com/swapnakpanda/Iโ€ฆ
๐Ÿ“‹ Properties we covered

โžŠ font-family
โž‹ font-size
โžŒ font-weight
โž font-style
โžŽ font-variant
โž text-decoration
โž text-transform
โž‘ color
Read 14 tweets
Mar 17
๐Ÿฆพ 11 Modern JavaScript Hacks

โ‡ฉ
๐Ÿ’ญ Why is this Thread?

โ‘ The code we write should be readable and, maintainable. But that doesn't mean it should be verbose.

โ’ With ECMAScript new specifications, many newer syntaxes are available which we should try to use mostly.

โ‘ Let's explore few such modern tricks.
๐Ÿ“‹ Table of Contents

โžŠ Conversion to Number
โž‹ Conversion to Boolean
โžŒ Conversion to String
โž Complex String
โžŽ Short Circuit && / ||
โž Nullish Check
โž Default Value
โž‘ Default Function Parameter
โž’ Optional Chaining
โž“ Array Resizing
โžŠโžŠ Function Rest Parameter
Read 16 tweets
Mar 16
60+ Shorthand Properties : CSS Cheat Sheet

โ‡ฉ
๐ŸŒ† Direct Link for High Resolution Image

If you liked this one, give a โญ๏ธ to this GitHub repo to support my work.

โœง Direct Link:
github.com/swapnakpanda/Iโ€ฆ
Read 10 tweets
Mar 15
Why <!DOCTYPE html>?

โ‡ฉ
โžŠ History

โœง In the old days of the web, pages were written in two versions: One for Netscape Navigator, and one for Microsoft IE.

โœง When the web standards were made at W3C, browsers could not just start using them, as doing so would break most existing sites on the web.
โœง Browsers therefore introduced two modes to treat new standards compliant sites differently from old legacy sites.

โœง Modes were: Quirks Mode and Standards Mode.

โœง For HTML documents, browsers use a DOCTYPE in the beginning of the document to decide which mode to handle.
Read 12 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(