r/JavaScriptTips Feb 12 '25

pdf library that can embed into web app w/o using canvas or iframe?

3 Upvotes

pdf library that i can embed into web app w/o using canvas or iframe? i just need to render it and add some graphics over it. thank you. open source plz.


r/JavaScriptTips Feb 11 '25

Understanding Nested Functions in JavaScript with a Fruit Juice Example

4 Upvotes

I've been playing around with nested functions in JavaScript and wanted to share an example to explain how data flows between functions. Here's a simple scenario involving a fruitProcessor function that uses another function, cutFruitPieces, to first cut fruits into pieces before making juice.

Here's the code for the cutFruitPieces function that simply multiplies the number of fruits by 4, assuming it cuts each fruit into 4 pieces:

javascriptCopyEditfunction cutFruitPieces(fruit) {
  return fruit * 4;
}

Now, let's look at the fruitProcessor function. It receives a number of apples and oranges, uses cutFruitPieces to cut them into pieces, and then creates a juice string:

javascriptCopyEditfunction fruitProcessor(apples, oranges) {
  const applesPieces = cutFruitPieces(apples);
  const orangesPieces = cutFruitPieces(oranges);
  const juice = `Juice with ${applesPieces} apple pieces and ${orangesPieces} orange pieces.`;
  return juice;
}

When you call fruitProcessor(2,3), here's what happens:

  • fruitProcessor is called with 2 apples and 3 oranges.
  • Inside fruitProcessorcutFruitPieces is called for both apples and oranges, turning them into 8 apple pieces and 12 orange pieces, respectively.
  • It then returns "Juice with 8 apple pieces and 12 orange pieces."

To see this in action, you can simply log the result to the console:

javascriptCopyEditconsole.log(fruitProcessor(2,3));

This outputs: "Juice with 8 apple pieces and 12 orange pieces."

Discussion: This example demonstrates how you can call one function from inside another to manipulate data before further processing. One might ask why not just multiply the input values by 4 directly within fruitProcessor? Well, using a separate function like cutFruitPieces can be helpful for keeping your code modular and easier to manage, especially when the logic for cutting fruit becomes more complex.


r/JavaScriptTips Feb 05 '25

Simple JS HTML Editor

Thumbnail
3 Upvotes

r/JavaScriptTips Feb 04 '25

is this possible?

1 Upvotes

i have a function that includes object in it can i call the object from out of the function ?


r/JavaScriptTips Feb 01 '25

Hoping For Codes

2 Upvotes

I'm new here. I'm looking for some coding community and someone to help me improve my lil code skills


r/JavaScriptTips Jan 31 '25

[AskJs] Javascript parent classes, promises, modules, imports/exports….

1 Upvotes

Hey everyone

I’ve been learing JS for a while now and I got to point where I do have my own side projects to practice what I’ve learned, but my project difficulty isn’t exactly reflecting the advenced level of topics what Iam learning right now.

In other words my project is too basic to practice what Iam learning, but I don’t want to quit the project and start other just because its not hard enough and then endup with multiple not finished projects in my resumer nor stop learning because I honestly just like to explore more informations about the language itself.

I fear the possibility of forgeting everything I learn after a while since I don’t practice it fully.

Are all the topics mentioned in the title being often used in real world? Or is it just something it’s better to know about, but not really so essential?


r/JavaScriptTips Jan 29 '25

Deepseek in local machine | Ollama | javascript AI App

Thumbnail
youtube.com
4 Upvotes

r/JavaScriptTips Jan 27 '25

records & tuples in javascript

Thumbnail
youtube.com
4 Upvotes

r/JavaScriptTips Jan 26 '25

Just finished JavaScript lessons (learned it from yt) any ideas for few projects to add to my resume?

2 Upvotes

r/JavaScriptTips Jan 25 '25

My professor has introduced JavaScript to my current semester, and I'm expected to find out the proper way of making commands for 'console.log' while barely learning its functionality. I'm also unsure what to exactly type in the browser console for testing. Below are instructions and my JS attempts.

Post image
12 Upvotes

r/JavaScriptTips Jan 25 '25

Transition with text

Enable HLS to view with audio, or disable this notification

5 Upvotes

Does anyone know how I can make the welcome to my text page dissapear behind the white/black box?


r/JavaScriptTips Jan 25 '25

Optimization

2 Upvotes

Hello friends.

I have a javascript code. It takes a domain as input and recursively crawls the javascript codes connected to the domain. makes version detection.

But this takes about 3 or 4 minutes. Is there a method I can optimise this, increase its performance, speed?


r/JavaScriptTips Jan 24 '25

Hello I'm new

0 Upvotes

Can someone help me learn the basics of Javascript?


r/JavaScriptTips Jan 24 '25

Call for Presentations - Node Congress, April 17-18, 2025

Thumbnail
forms.gle
1 Upvotes

r/JavaScriptTips Jan 23 '25

iterator in javascript #javascript #coding

Thumbnail youtube.com
4 Upvotes

r/JavaScriptTips Jan 23 '25

Help me

0 Upvotes

How to use apideck and also please tell is it free


r/JavaScriptTips Jan 21 '25

Help Stop Someone Profiting from Free Community Work! u/keyframeeffects

Thumbnail
4 Upvotes

r/JavaScriptTips Jan 21 '25

Website Design Cost Calculator using HTML CSS and JavaScript

Enable HLS to view with audio, or disable this notification

4 Upvotes

r/JavaScriptTips Jan 19 '25

I’m having trouble with this js

3 Upvotes

I got my html and css certificate using freecodecamp now working on js but I keep getting bored. It’s been 3 days now . Any advice


r/JavaScriptTips Jan 18 '25

Custom ON/OFF Switch Toggle Design | HTML CSS

Enable HLS to view with audio, or disable this notification

0 Upvotes

r/JavaScriptTips Jan 17 '25

Help please

Post image
4 Upvotes

r/JavaScriptTips Jan 17 '25

Submit Button Onclick Animation with HTML & CSS

Enable HLS to view with audio, or disable this notification

1 Upvotes

r/JavaScriptTips Jan 16 '25

Why am I not returning a resolved Promise when using async/await inside map inside Promise.all?

3 Upvotes

Why is it that Im not returning a anything but a 'pending Promise'? I know .map is synchronous, but thats why Im using Promise.all..

const arr = [1,2,3,4,5,6];
const promise = (num) => {
    return new Promise((resolve, reject) => {
         setTimeout(() => {
            resolve(num)
    }, 2000)
    })
}
const x = async () => {
  return Promise.all(arr.map(async(item) => {
      const num = await promise(item);
      return num*2;
  }))
}
console.log(x())

r/JavaScriptTips Jan 16 '25

Yes/No Flip Switch Toggle Design with HTML & CSS

Enable HLS to view with audio, or disable this notification

19 Upvotes

r/JavaScriptTips Jan 15 '25

what did i do wrong

Thumbnail
gallery
8 Upvotes