D
D
Dubolom Unicellular2020-04-22 17:07:45
JavaScript
Dubolom Unicellular, 2020-04-22 17:07:45

How to make one method declaration through 2 method names (el.size.width();)?

I have a question... but how to make it so that one method can be called through two method names.
Like this: I want to make sure that all methods are sorted, because the width is the size of something. Therefore, to set an element's width, you need to refer to the "directory" (size) to which the width (width) refers. I hope I explained clearly. The code example is of course not very good, but if it is at all possible to do it, try to explain it on it.
el.size.width(50);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-04-23
@crystalbit

you can create a size property as an object with a width method
of type
el.size = {
width: function(data) {
// setting the width
}
}
and a bunch of other options with different syntax, but the essence is the same

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question