WeChat Mini Programs sample code has a property of an object that does not have a colon.

just started to learn the front end,
source code in the "success" and "fail", why there are no colons?
I learned something like this.
is it written in a new way?

< H1 > what I imagined it to be: < / H1 >
{
   url: opts.loginUrl,
   ...
   success: function(result) {},
   fail: function(err) {}
}
< H1 > the source code is as follows: < / H1 >
wx.request({
            url: opts.loginUrl,
            header: header,
            method: opts.method,
            success (result) {
                const data = result.data;

                if (!data || data.code !== 0 || !data.data || !data.data.skey) {
                    return opts.fail(new Error(`${JSON.stringify(data)}`))
                }

                const res = data.data

                if (!res || !res.userinfo) {
                    return opts.fail(new Error(`(${data.error}):${data.message}`))
                }

                // 
                Session.set(res)
                opts.success(res.userinfo)
            },
            fail (err) {
                console.error("")
                opts.fail(err)
            }
});
< H1 > Arrow functions also have colons < / H1 >
qcloud.login({
                success: res => {
                    this.setData({ userInfo: res, logged: true })
                    util.showSuccess("")
                },
                fail: err => {
                    console.error(err)
                    util.showModel("", err.message)
                }
})
May.08,2022

this is just a concise representation of ES6 object properties, which is a little more convenient to use, and has nothing to do with Mini Program. If you want to know more, take a look at Ruan Yifeng's introduction to es6

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaad66-2006.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaad66-2006.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?