menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Javascript

Javascript

source image

Dev

1M

read

156

img
dot

Image Credit: Dev

How I Built a Unified Blog Aggregator with HTML, CSS, and JavaScript

  • A retired U.S. Army Staff Sergeant created a static blog aggregator using HTML, CSS, and JavaScript to centralize content from different platforms.
  • The project aimed to address the issue of scattered posts across various platforms for easier reader access.
  • The blog aggregator utilized manual JSON files for data management, avoiding reliance on unstable APIs and allowing for easy updates.
  • Key features included dynamic post loading, filtering and search options, futuristic UI touches, and solutions to challenges like timezone mismatches and mobile responsiveness.

Read Full Article

like

9 Likes

source image

Hackernoon

1M

read

411

img
dot

Image Credit: Hackernoon

Build Your Own Polyfills for Call, Apply, and Bind in JavaScript

  • Polyfills are code snippets usually written in JavaScript to add functionality to older browsers that lack native support for certain features.
  • Call, apply, and bind are essential for function manipulation in JavaScript, akin to the Avengers.
  • Polyfills for call, apply, and bind were provided along with their explanation and usage in the article.
  • By creating these polyfills, you can enhance the functionality of older browsers and creatively manipulate JavaScript's behavior.

Read Full Article

like

24 Likes

source image

Medium

1M

read

86

img
dot

Image Credit: Medium

var, let, const: Choosing the Right Variable Declaration in Modern JavaScript

  • Variables in JavaScript are essential for storing data and can be declared using var, let, or const.
  • Good naming practices for variables enhance code readability and maintainability.
  • Using 'use strict'; directive helps in preventing unintended global variable declarations.
  • Understanding the differences between var, let, and const is crucial for writing clean and predictable JavaScript code.

Read Full Article

like

5 Likes

source image

Dev

1M

read

146

img
dot

Image Credit: Dev

🧠 Understanding the JavaScript Event Loop: A Beginner's Guide

  • The Event Loop is a mechanism that allows JavaScript to perform non-blocking operations by offloading operations to the system kernel whenever possible.
  • The Event Loop consists of several components including the Call Stack, Web APIs, Callback Queue (Task Queue), and Microtask Queue.
  • The Event Loop works by continuously checking the call stack and task queues, executing tasks from the queue when the stack is empty.
  • Promises and MutationObserver callbacks are queued in the Microtask Queue, which has higher priority than the callback queue.

Read Full Article

like

8 Likes

source image

Dev

1M

read

132

img
dot

Image Credit: Dev

Daily JavaScript Challenge #JS-166: Find the Sum of All Prime Numbers Up to N

  • Write a function that accepts an integer N and returns the sum of all prime numbers less than or equal to N.
  • Check out the documentation about this topic here: https://en.wikipedia.org/wiki/Prime_number
  • Drop your thoughts and questions in the comments below. 👇
  • Part of the Daily JavaScript Challenge series. Follow for daily programming challenges and let's grow together! 🚀

Read Full Article

like

7 Likes

source image

Dev

1M

read

242

img
dot

Image Credit: Dev

JavaScript basics for future me

  • Link css-stylesheet and js-file
  • Run live server
  • To declare a variable and print it out
  • Use const when a variable can't be reassigned

Read Full Article

like

14 Likes

source image

Dev

1M

read

265

img
dot

Image Credit: Dev

JavaScript Interview Trick: typeof vs instanceof

  • The 'typeof' operator in JavaScript is used to return a string indicating the type of the operand.
  • The 'instanceof' operator in JavaScript is used to check the current object and returns true if an object is an instance of a particular class or constructor.
  • The 'typeof' operator is used when you want to know the type of a primitive value.
  • The 'instanceof' operator is used when you want to know if an object is an instance of a certain class.

Read Full Article

like

15 Likes

source image

Dev

1M

read

448

img
dot

Image Credit: Dev

JavaScript Execution Context Explained

  • Understanding the execution context is fundamental to grasping how JavaScript code runs.
  • An execution context is an abstract environment where JavaScript code is evaluated and executed.
  • Execution context types include Global Execution Context (GEC), Function Execution Context (FEC), and Eval Execution Context.
  • This binding in JavaScript depends on how a function is invoked.

Read Full Article

like

26 Likes

source image

Medium

1M

read

54

img
dot

Image Credit: Medium

Mastering Scroll Tracking: Handling Hidden and Dynamic Content with JavaScript

  • To handle hidden and dynamic content with JavaScript, there are two main steps: getting the y position of the element relative to the page and calculating the offset for accurate scroll calculation.
  • The calculateHiddenY function helps retrieve the y position regardless of whether the elements are hidden or not, allowing correct scroll range and percentage calculations.
  • To track scroll in increments of 10% for hidden elements, we can use the scroll event listener and remove it when the page is unloaded.
  • Sending the tracking data to a backend endpoint can be achieved using the sendReportToBackend function, and it's advisable to implement a debounce function to reduce backend report frequency.

Read Full Article

like

3 Likes

source image

Dev

1M

read

320

img
dot

Image Credit: Dev

Daily JavaScript Challenge #JS-165: Calculate Product Excluding Self

  • Given an array of integers, return a new array where each element at index i of the new array is the product of all the numbers in the original array except the one at i.

Read Full Article

like

19 Likes

source image

Medium

1M

read

69

img
dot

Image Credit: Medium

The Mechanics Behind JavaScript’s typeof and instanceof

  • typeof in JavaScript is a method to determine the type of a given value, but it has some quirks like returning 'object' for null and arrays.
  • It categorizes values into only eight possible results, such as 'number', 'boolean', and 'function'.
  • Checking for null with typeof can be misleading, and it's advised to use strict equality checks for null values.
  • typeof considers arrays as objects in JavaScript because arrays are a special type of object with additional behaviors.
  • To specifically check if a value is an array, Array.isArray() should be used.
  • Functions are treated uniquely by typeof, returning 'function' as the type, even though functions are technically objects.
  • Instances of functions like async generator functions or callable Proxy objects are also categorized as 'function' by typeof.
  • For primitive types, typeof works as expected, providing a straightforward way to identify basic values.
  • Boxed versions of primitives, created by wrapper constructors, may lead to confusion as typeof returns 'object' for them.
  • The instanceof operator in JavaScript examines the connection between an object and its prototype chain, focusing on inheritance rather than creation.

Read Full Article

like

4 Likes

source image

Medium

1M

read

197

img
dot

Image Credit: Medium

10 Essential Skills and Practices Every Beginner Must Master to Excel in Python or JavaScript

  • Master the Fundamentals of Programming, including variables and data types, conditional statements, loops, functions, and error handling.
  • Learn and Practice Problem-Solving Techniques by solving coding problems daily, focusing on algorithm design and optimization.
  • Understand Data Structures and Algorithms (DSA) like arrays, strings, linked lists, and sorting and searching algorithms.
  • Develop the Habit of Writing Clean and Readable Code by using meaningful variable names, small modular functions, comments, and following coding style guides.

Read Full Article

like

11 Likes

source image

Logrocket

1M

read

137

img
dot

Image Credit: Logrocket

6 hidden gems in the JavaScript API you should be using

  • The article discusses six hidden gems in the JavaScript API that developers should be using: structuredClone, EyeDropper, AbortController, Intersection Observer, ResizeObserver, and the Clipboard API.
  • These APIs offer solutions to various problems and provide more dynamic and user-friendly application development without the need for external libraries.
  • The challenges in adopting these APIs include their novelty, limited browser support, lack of awareness, and addressing niche use cases.
  • structuredClone offers a way to deep clone complex objects without external libraries, solving issues such as circular references and special values.
  • EyeDropper API allows developers to implement a color picker natively without external packages, enhancing functionalities like photo editors.
  • AbortController helps in managing stale requests in search UI components by allowing developers to cancel already sent requests.
  • Intersection Observer enables lazy loading images, playing videos when visible, or implementing infinite scrolling without npm packages.
  • ResizeObserver allows developers to run code when HTML elements change size, offering solutions for auto-scaling text and handling complex UI behaviors.
  • The Clipboard API provides the ability to copy text and images to the system clipboard, offering a modern alternative to the deprecated document.execCommand('copy').
  • By leveraging these native browser APIs, developers can enhance their applications with features like deep cloning, color picking, managing requests, lazy loading, responsive UI behavior, and clipboard operations.

Read Full Article

like

8 Likes

source image

Medium

1M

read

105

img
dot

Image Credit: Medium

The Hidden JavaScript Tricks That Increased My App’s Speed by 10x!

  • Lazy loading is a JavaScript trick that can significantly improve the speed of web apps.
  • It involves loading only the essential parts of the app first, such as main content and visible features.
  • Images, charts, and hidden sections are loaded only when the user interacts with them.
  • Implementing lazy loading and deferring or async loading of third-party scripts can lead to a 10x increase in app loading speed.

Read Full Article

like

6 Likes

source image

Dev

1M

read

362

img
dot

Image Credit: Dev

Javascript - ServiceNow

  • ServiceNow is built on JavaScript.
  • Both client-side and server-side scripting are used in ServiceNow.
  • Client-side scripting is used for form manipulation, field validation, and UI actions.
  • Server-side scripting is used for database operations, automation, and backend processing.

Read Full Article

like

21 Likes

For uninterrupted reading, download the app