jtzuya
jtzuya
KPCKevin Powell - Community
Created by jtzuya on 5/3/2024 in #front-end
JS Canvas shape duplication issues
He guys, I just bumped into this issue while creating a drawing app. I started with stroke rectangle shapes, it works fine in some places inside the canvas but when it reached around 50% to the right of the canvas it keeps printing. I really appreciate if someone can help point what is wrong with this code thank you! video: https://www.loom.com/share/958daa9f8db643e59f1b987061886128 code: https://codepen.io/jtzuya/pen/eYoweNa?editors=1111
3 replies
KPCKevin Powell - Community
Created by jtzuya on 11/29/2022 in #front-end
I found a website and it has a very interesting scroll animation
6 replies
KPCKevin Powell - Community
Created by jtzuya on 11/29/2022 in #front-end
is it possible to throw your local variable out to globally so that you can reuse it?
e.g.

let x = 'a random string'

function test() {
let y = 'bzzz'
return y
}

let x = 'a random string'

function test() {
let y = 'bzzz'
return y
}
I want to use the 'y' variable globally, is that possible?
8 replies
KPCKevin Powell - Community
Created by jtzuya on 11/21/2022 in #front-end
using Regex in an if else statement
hey guys, I created and logical statement with regex init but doesn't seem to work
let operation = Math.floor((Math.random() * name.length - 1))
if(name[operation] === /\s$/g || name[operation] === undefined) return mathChallenge(name)
let operation = Math.floor((Math.random() * name.length - 1))
if(name[operation] === /\s$/g || name[operation] === undefined) return mathChallenge(name)
so basically on my statement, instead of using " ", I used regex of space. I wonder if using regex is executable and if so, how should it supposed to be
4 replies
KPCKevin Powell - Community
Created by jtzuya on 11/11/2022 in #front-end
How export a nested variable from a function?
10 replies
KPCKevin Powell - Community
Created by jtzuya on 11/7/2022 in #front-end
Exclude non-numbers while pushing to an empty array
13 replies
KPCKevin Powell - Community
Created by jtzuya on 10/13/2022 in #back-end
Webpack output to the wrong directory
Hey guys, I have a quick question. I've got this webpack setup
const path = require('path')

module.exports = {
"mode": "development",
entry: {
main: './src/module.js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '/assets')
}
}
const path = require('path')

module.exports = {
"mode": "development",
entry: {
main: './src/module.js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '/assets')
}
}
And I would like to compile my output in the 'assets' folder but when I run npm start it rather compile to the wrong directory
'/public' directory
asset main.js
'/public' directory
asset main.js
output after compiling. I'd want it to be compiled here
'/assets' directory
'/assets' directory
Thanks for the answers🙌🏼
2 replies
KPCKevin Powell - Community
Created by jtzuya on 10/9/2022 in #front-end
.sort()
Hi guys I try sorting my array, and unfortunately I was not able to return it in a particular a-z
9 replies
KPCKevin Powell - Community
Created by jtzuya on 10/8/2022 in #front-end
About Array lengths
Hi guys I have a question, let's say I got an array. Then I will execute an if statement saying
if(!array.length) return
if(!array.length) return
Now the question, does mean that the arrays length is equal to 0... or null? And is it different if I say
if(array.length === 0) return
if(array.length === 0) return
Thanks 🙌🏼
2 replies