I was just going though some source code here on the index file of glide.js and saw the following code :
mount (extensions = {}) {
this._e.emit('mount.before')
if (isObject(extensions)) {
this._c = mount(this, extensions, this._e)
} else {
warn('You need to provide a object on `mount()`')
}
this._e.emit('mount.after')
return this
}
So basically mount (extensions = {}) {}
is a method inside the Glide
class and the mount being invoked inside this mount method is a function that is being imported like so:
import { mount } from './core/index'
My question is how does JavaScript differentiate between recursively calling the mount method or the imported function since both have the same name ?
note ::- code can be found here.