diff --git a/zh-cn/application-dev/reference/apis/js-apis-url.md b/zh-cn/application-dev/reference/apis/js-apis-url.md index eab93b045720c98fe9c3da9cde16a1f921f745a5..f7a30ab9b74c73fc034b9d8f37d69ff1337a21f2 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-url.md +++ b/zh-cn/application-dev/reference/apis/js-apis-url.md @@ -108,10 +108,10 @@ getAll(name: string): string[] **示例:** ```js -let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.append('fod', '3'); // Add a second value for the fod parameter. -console.log(params.getAll('fod')) // Output ["1","3"]. +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let params = new Url.URLSearchParams(urlObject.search.slice(1)); +params.append('fod', '3'); // Add a second value for the fod parameter. +console.log(params.getAll('fod').toString()) // Output ["1","3"]. ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-util.md b/zh-cn/application-dev/reference/apis/js-apis-util.md index e5c8b0cd6d73d722deeb2b09230a02ad2c2bbef2..6c377e24bdb11ebd6c3ff67625e5dfffdebef286 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-util.md +++ b/zh-cn/application-dev/reference/apis/js-apis-util.md @@ -151,16 +151,16 @@ promiseWrapper(original: (err: Object, value: Object) => void): Function **示例:** ```js - function aysnFun(str1, str2, callback) { - if (typeof str1 === 'string' && typeof str2 === 'string') { - callback(null, str1 + str2); - } else { - callback('type err'); - } + function aysnFun(str1, str2) { + if (typeof str1 === 'object' && typeof str2 === 'object') { + return str2 + } else { + return str1 + } } let newPromiseObj = util.promiseWrapper(aysnFun); - newPromiseObj("Hello", 'World').then(res => { - console.log(res); + newPromiseObj({ err: "type error" }, {value:'HelloWorld'}).then(res => { + console.log(res); }) ```