JavaScript基础与核心技术解析

需积分: 48 96 下载量 54 浏览量 更新于2024-08-08 收藏 9.7MB PDF 举报
"《实变函数习题精选》作者: 徐森林等编,出版年: 2011年" 本文将详细讲解JavaScript中涉及的一些核心知识点,包括字符串对象、数组对象、时间对象和数学对象的基础知识,以及DOM基础。 在JavaScript中,字符串对象是处理文本数据的基本方式。第05章介绍了以下几个字符串操作: 1. 获取字符串长度:通过`length`属性获取字符串中字符的数量。 2. 大小写转换:`toUpperCase()`将字符串转为大写,`toLowerCase()`转为小写。 3. 获取单个字符:通过索引访问,如`str[index]`。 4. 截取字符串:`substring()`或`slice()`方法用于截取字符串的一部分。 5. 替换字符串:`replace()`方法用于替换匹配的子串。 6. 分割字符串:`split()`方法按照指定分隔符将字符串拆分成数组。 7. 检索位置:`indexOf()`和`lastIndexOf()`查找子串在字符串中的位置。 8. 删除字符:训练题中提出了删除特定字符的操作。 9. 查找字符串:训练题中要求找到并返回指定的字符串。 10. 统计数字个数:训练题要求统计字符串中数字的数量。 第06章介绍了数组对象,这是处理有序数据的关键: 1. 数组的创建:可以通过字面量`[]`或`Array()`构造函数创建。 2. 获取和赋值:通过索引访问和修改元素,如`arr[index]`。 3. 获取长度:`length`属性获取数组元素数量。 4. 截取数组:`slice()`方法用于截取数组的一部分。 5. 添加元素:`unshift()`在开头添加,`push()`在末尾添加。 6. 删除元素:`shift()`移除首元素,`pop()`移除末元素。 7. 比较大小:数组的比较操作常用于排序。 8. 颠倒顺序:`reverse()`方法用于反转数组元素顺序。 9. 转换为字符串:`join()`方法将数组元素连接成字符串。 10. 数组与字符串转换:训练题涉及了数组与字符串之间的转换操作。 第07章讲述了时间对象,处理日期和时间: 1. 日期对象提供了操作日期和时间的功能。 2. 操作年月日和时分秒:通过各种属性和方法设置和获取日期和时间的各个部分。 3. 获取星期几:`getDay()`返回一周中的哪一天(0-6)。 4. 在页面显示时间:训练题要求将时间显示在HTML页面上。 第08章介绍了数学对象,提供了数学运算: 1. Math对象包含了许多数学常量和方法。 2. 获取最大值和最小值:`max()`和`min()`方法。 3. 取整运算:`Math.floor()`向下取整,`Math.ceil()`向上取整。 4. 三角函数:如`sin()`, `cos()`, `tan()`等。 5. 生成随机数:`Math.random()`生成0到1之间的小数,可通过乘法和取整得到指定范围的随机数。 最后,第09章介绍了DOM基础,这是前端开发中的重要部分: 1. DOM(文档对象模型)是一种标准,用于表示HTML或XML文档的结构。 2. DOM对象代表了网页中的每个元素,允许我们进行查找、添加、修改和删除元素。 3. 节点类型:元素节点、文本节点、属性节点等。 4. 获取元素:`getElementById()`, `getElementsByTagName()`, `getElementsByClassName()`, `querySelector()`和`querySelectorAll()`等方法。 5. 创建元素:使用`createElement()`方法。 6. 插入元素:`appendChild()`和`insertBefore()`方法。 7. 删除元素:`removeChild()`方法。 8. 复制元素:`cloneNode()`方法。 9. 替换元素:`replaceChild()`方法。 这些基本概念和操作构成了JavaScript编程的基础,对于Web前端开发者来说至关重要。通过深入理解和实践,可以有效提升开发技能。

{ type: "searchSelect", placeholder: "签约机构", valueName: 'signOrganId', optionName: "label", searchItemName: "label", optionId: "key", searchApi:commonService.orgPageList({}).then(res=>{ const {retData}=res retData.map(item=>{ return {key: item.id, label: item.organName, value: item.id,} }) }) }, 分析一下此段代码的报错 汉语解释index.jsx:55 Uncaught TypeError: item.searchApi is not a function at searchQuery (index.jsx:55:1) at onFocus (index.jsx:129:1) at onContainerFocus (BaseSelect.js:326:1) at HTMLUnknownElement.callCallback (react-dom.development.js:188:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:237:1) at invokeGuardedCallback (react-dom.development.js:292:1) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:306:1) at executeDispatch (react-dom.development.js:389:1) at executeDispatchesInOrder (react-dom.development.js:414:1) at executeDispatchesAndRelease (react-dom.development.js:3278:1) at executeDispatchesAndReleaseTopLevel (react-dom.development.js:3287:1) at forEachAccumulated (react-dom.development.js:3259:1) at runEventsInBatch (react-dom.development.js:3304:1) at runExtractedPluginEventsInBatch (react-dom.development.js:3514:1) at handleTopLevel (react-dom.development.js:3558:1) at batchedEventUpdates$1 (react-dom.development.js:21871:1) at batchedEventUpdates (react-dom.development.js:795:1) at dispatchEventForLegacyPluginEventSystem (react-dom.development.js:3568:1) at attemptToDispatchEvent (react-dom.development.js:4267:1) at dispatchEvent (react-dom.development.js:4189:1) at unstable_runWithPriority (scheduler.development.js:653:1) at runWithPriority$1 (react-dom.development.js:11039:1) at discreteUpdates$1 (react-dom.development.js:21887:1) at discreteUpdates (react-dom.development.js:806:1) at dispatchDiscreteEvent (react-dom.development.js:4168:1)

2023-07-13 上传

runtime-core.esm-bundler.js:41 [Vue warn]: Unhandled error during execution of beforeMount hook at <App> warn @ runtime-core.esm-bundler.js:41 logError @ runtime-core.esm-bundler.js:216 handleError @ runtime-core.esm-bundler.js:208 callWithErrorHandling @ runtime-core.esm-bundler.js:160 callWithAsyncErrorHandling @ runtime-core.esm-bundler.js:166 hook.__weh.hook.__weh @ runtime-core.esm-bundler.js:2655 invokeArrayFns @ shared.esm-bundler.js:77 componentUpdateFn @ runtime-core.esm-bundler.js:5657 run @ reactivity.esm-bundler.js:178 instance.update @ runtime-core.esm-bundler.js:5814 setupRenderEffect @ runtime-core.esm-bundler.js:5822 mountComponent @ runtime-core.esm-bundler.js:5612 processComponent @ runtime-core.esm-bundler.js:5565 patch @ runtime-core.esm-bundler.js:5040 render @ runtime-core.esm-bundler.js:6332 mount @ runtime-core.esm-bundler.js:3824 app.mount @ runtime-dom.esm-bundler.js:1431 eval @ main.js:7 ./src/main.js @ app.js:85 __webpack_require__ @ app.js:359 (匿名) @ app.js:1539 __webpack_require__.O @ app.js:405 (匿名) @ app.js:1540 (匿名) @ app.js:1542 app.js:362 Uncaught TypeError: (0 , _test__WEBPACK_IMPORTED_MODULE_1__.holleTest) is not a function at eval (App.vue:77:1) at eval (runtime-core.esm-bundler.js:2675:1) at callWithErrorHandling (runtime-core.esm-bundler.js:158:1) at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:166:1) at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2655:1) at invokeArrayFns (shared.esm-bundler.js:77:1) at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5657:1) at ReactiveEffect.run (reactivity.esm-bundler.js:178:1) at instance.update (runtime-core.esm-bundler.js:5814:1) at setupRenderEffect (runtime-core.esm-bundler.js:5822:1)

2023-06-11 上传