Answer the question
In order to leave comments, you need to log in
Initialize parameters in JavaScript?
Hello, I'm trying to write my own carousel
, there is a file with default.ts settings
export default {
container: '.carousel',
slidesToShow: 4,
slidesToScroll: 1,
}
import params from './carousel/default'
export class Carousel {
constructor(
...args
) {
if (args.length > 0) {
if (typeof args[0] === 'string') {
params.container = args[0]
}
}
let vpar = args[1]
for(var item in vpar) {
console.log(vpar[item])
}
}
}
new Carousel('.carousel', {
slidesToShow: 4,
slidesToScroll: 1,
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question