DEV Community

vishal.codes
vishal.codes

Posted on

Day 2/366

๐Ÿš€ Today's Learning:

๐ŸŒŸ DSA

  • Memory Units (bits and Bytes)
  • Character Encoding Schemes - ASCII & Unicode

๐ŸŒŸ Dev

  • Difference between innerText and textContent.
  • Use of data attribute for a HTML element
  • Difference between loading lazy and loading eager on img tag.
  • Difference between rem, em and px.
  • Difference between max-width and min-width.

๐Ÿ” Some Key Highlights:

DSA

  • Bit: Short for binary digit (0 or 1), a bit is the basic unit of information in computing and digital communications.
  • Byte: A byte is a unit of digital information that consists of 8 bits. Bytes are commonly used to represent characters, such as letters and numbers, in computer systems. For example, the ASCII encoding scheme uses 1 byte to represent each character (ASCII code for the letter 'A' is 65 i.e. 01000001 in binary)
  • In Short:โ†’

    1 bit = 1 binary digit ( 0 or 1)
    8 bits = 1 Byte
    1024 Bytes = 1 KB
    1024 KB = 1 MB = 1 M x 8 bits = 8 Mb (8 Megabits)
    (so 1 Mb = 1/8 MB)

Note: The MB which people talk about in daily uses like a file size or download speed is actually the Mega Bytes (MB)

โ†’ So if you see a wifi recharge plan with speed upto 30 Mbps, It is 30 Megabits per second, means โ†’ 30/8 MB/sec = 3.75 MB/sec. Hence, the download speed will be upto 3.75 MB/sec in this plan.

  • ASCII primarily covers characters from the English alphabet, digits, punctuation marks, and control characters while Unicode can represent characters from all languages, scripts, and symbols worldwide from various scripts, including Latin, Cyrillic, Greek, Arabic, Chinese, Japanese, Korean, and many more, as well as emoji symbols.

  • Unicode uses different encoding forms, such as UTF-8, UTF-16, and UTF-32, to represent characters. Among these, UTF-8 is the most commonly used encoding on the web. For example:

  • The Unicode code point for the Latin capital letter 'A' is U+0041.

  • The Unicode code point for the Devanagari letter 'เค•' (ka) is U+0915.

  • The Unicode code point for the emoji "smiling face with sunglasses" is U+1F60E.

  • In HTML, by using UTF-8 encoding and declaring it in the <meta> tag, you ensure that your HTML document can handle a wide range of characters and symbols, making it suitable for internationalization and multilingual content.

DEV

  • innerText returns visible text, while textContent returns all text including hidden and line breaks.
  • data attributes allow storing extra information on HTML elements, useful for JavaScript.
  • loading="lazy" delays loading images until they enter the viewport, while loading="eager" loads them immediately.
  • rem is relative to the root font size.
  • em is relative to its parent's font size.
  • px is an absolute unit of measurement.
  • max-width limits the maximum width an element can have.
  • min-width sets the minimum width an element must have.

#1PercentPlusPlus #100DaysOfCode #LearningEveryday #LearnInPublic #Programming #Coding #DSA #SoftwareDevelopment

Top comments (0)