How to define global function 【Javascript】

--

We sometimes want to develop global function which is common in software. For example, it is a function that notifies users of errors. In that case, we can use window object.

import notify from 'path/to/notify'window.notify = notifyfunction a () {
notify()
}

function b () {
notify()
}

My LinkedIn account is below! Please contact me!

https://www.linkedin.com/in/tomoharu-tsutsumi-56051a126/

--

--

Tomoharu Tsutsumi

Software Engineer with 4 years of professional experience. Studying Computer Science in a college.

Recommended from Medium

Lists