From 5e7985cb8a9528a10c28ed3b2319dcab465f67ab Mon Sep 17 00:00:00 2001 From: shikai-123 Date: Fri, 22 Jul 2022 16:37:54 +0800 Subject: [PATCH] Modify ide err issues: https://gitee.com/openharmony/docs/issues/I5IH0X Signed-off-by: shikai-123 --- .../reference/apis/js-apis-url.md | 8 ++++---- .../reference/apis/js-apis-util.md | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-url.md b/en/application-dev/reference/apis/js-apis-url.md index fd82670670..89b4294e39 100755 --- a/en/application-dev/reference/apis/js-apis-url.md +++ b/en/application-dev/reference/apis/js-apis-url.md @@ -108,10 +108,10 @@ Obtains all the key-value pairs based on the specified key. **Example** ```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/en/application-dev/reference/apis/js-apis-util.md b/en/application-dev/reference/apis/js-apis-util.md index 2ac8daeb37..f884709dc2 100755 --- a/en/application-dev/reference/apis/js-apis-util.md +++ b/en/application-dev/reference/apis/js-apis-util.md @@ -119,16 +119,16 @@ Processes an asynchronous function and returns a promise version. **Example** ```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)("Hello", 'World'); - newPromiseObj.then(res => { - console.log(res); + let newPromiseObj = util.promiseWrapper(aysnFun); + newPromiseObj({ err: "type error" }, {value:'HelloWorld'}).then(res => { + console.log(res); }) ``` -- GitLab