ei
ei
KPCKevin Powell - Community
Created by ei on 5/3/2024 in #front-end
JS Canvas shape duplication issues
I see this makes more sense, thank you!
3 replies
KPCKevin Powell - Community
Created by ei on 11/29/2022 in #front-end
I found a website and it has a very interesting scroll animation
well I figured it out though, and is much easier by using GSAP
6 replies
KPCKevin Powell - Community
Created by ei on 11/29/2022 in #front-end
is it possible to throw your local variable out to globally so that you can reuse it?
yeah I think storing it inside an object makes it look cleaner, thanks!
8 replies
KPCKevin Powell - Community
Created by ei on 11/29/2022 in #front-end
is it possible to throw your local variable out to globally so that you can reuse it?
I see, thanks for pointing that out
8 replies
KPCKevin Powell - Community
Created by ei on 11/11/2022 in #front-end
How export a nested variable from a function?
I see, thanks man🙌🏼 OVA I need to change my code
10 replies
KPCKevin Powell - Community
Created by ei on 11/11/2022 in #front-end
How export a nested variable from a function?
So in the end, I just want to export this array of links that I get from the CSV and export it from one file to another and be able to reuse it to there🥲
10 replies
KPCKevin Powell - Community
Created by ei on 11/11/2022 in #front-end
How export a nested variable from a function?
yes exactly
10 replies
KPCKevin Powell - Community
Created by ei on 11/11/2022 in #front-end
How export a nested variable from a function?
yes I want to return the array and be able to reuse it on another JS file
10 replies
KPCKevin Powell - Community
Created by ei on 11/11/2022 in #front-end
How export a nested variable from a function?
sorry about that and thanks for the help and actually I changed the code to this
const form = document.getElementById('Form')
const inpFile = document.getElementById('inpFile')

let arr = []

form.addEventListener('submit', (e) => {
e.preventDefault()
const file = inpFile.files[0]
const reader = new FileReader()

reader.onload = (e) => {
const text = e.target.result
csvToArr(text);
}

reader.readAsText(file)
})

function csvToArr(text) {
const rows = text.slice(text.indexOf('\n')).split('\n')

for(let i = 0; i < rows.length; i++) {
if(rows[i].length !== 0 || rows[i] !== '') {
arr.push(rows[i])
} else {
console.log('nothing can be found')
}
}

return links(arr)
}

export const links = arr => {
const arrUrls = arr
console.log(arrUrls)
return arrUrls
}
const form = document.getElementById('Form')
const inpFile = document.getElementById('inpFile')

let arr = []

form.addEventListener('submit', (e) => {
e.preventDefault()
const file = inpFile.files[0]
const reader = new FileReader()

reader.onload = (e) => {
const text = e.target.result
csvToArr(text);
}

reader.readAsText(file)
})

function csvToArr(text) {
const rows = text.slice(text.indexOf('\n')).split('\n')

for(let i = 0; i < rows.length; i++) {
if(rows[i].length !== 0 || rows[i] !== '') {
arr.push(rows[i])
} else {
console.log('nothing can be found')
}
}

return links(arr)
}

export const links = arr => {
const arrUrls = arr
console.log(arrUrls)
return arrUrls
}
The problem now if it is possible to get the arrUrls after exporting my links to another js file if I call it there
import { links } from './uploader.js'
console.log(links)
import { links } from './uploader.js'
console.log(links)
😁 tbh I don't know what I'm doing
10 replies
KPCKevin Powell - Community
Created by ei on 11/7/2022 in #front-end
Exclude non-numbers while pushing to an empty array
THanks
13 replies
KPCKevin Powell - Community
Created by ei on 11/7/2022 in #front-end
Exclude non-numbers while pushing to an empty array
I see. Btw, it is working now
13 replies
KPCKevin Powell - Community
Created by ei on 11/7/2022 in #front-end
Exclude non-numbers while pushing to an empty array
Thanks for the help guys
13 replies
KPCKevin Powell - Community
Created by ei on 11/7/2022 in #front-end
Exclude non-numbers while pushing to an empty array
will try isNaN, but why NaN not working is kinda sketchy lmao 😅
13 replies
KPCKevin Powell - Community
Created by ei on 11/7/2022 in #front-end
Exclude non-numbers while pushing to an empty array
yes that's it
13 replies
KPCKevin Powell - Community
Created by ei on 10/13/2022 in #back-end
Webpack output to the wrong directory
btw fixed 😅
2 replies
KPCKevin Powell - Community
Created by ei on 10/9/2022 in #front-end
.sort()
I see, that's definitely helpful thanks man
9 replies
KPCKevin Powell - Community
Created by ei on 10/9/2022 in #front-end
.sort()
should be after C isn't it?
9 replies
KPCKevin Powell - Community
Created by ei on 10/9/2022 in #front-end
.sort()
See my "e-waste" is placed at index 10
9 replies
KPCKevin Powell - Community
Created by ei on 10/9/2022 in #front-end
.sort()
0
:
"Category_Changing Habits"
1
:
"Category_News"
2
:
"Category_Sustainability"
3
:
"Category_Waste Stream Management"
4
:
"FAQs"
5
:
"What are the benefits of recycling waste?"
6
:
"What type of waste can be recycled?"
7
:
"Which country recycles the most waste?"
8
:
"Why seperate waste?"
9
:
"compost"
10
:
"e-waste"
11
:
"recycle"
12
:
"waste"
13
:
"zerowaste"
0
:
"Category_Changing Habits"
1
:
"Category_News"
2
:
"Category_Sustainability"
3
:
"Category_Waste Stream Management"
4
:
"FAQs"
5
:
"What are the benefits of recycling waste?"
6
:
"What type of waste can be recycled?"
7
:
"Which country recycles the most waste?"
8
:
"Why seperate waste?"
9
:
"compost"
10
:
"e-waste"
11
:
"recycle"
12
:
"waste"
13
:
"zerowaste"
9 replies