Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacharia2 committed Feb 3, 2024
1 parent de2c9c3 commit b1e87ed
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
70 changes: 70 additions & 0 deletions tiddlers/游戏:编程谜题.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
谜题目标:从一个实际问题中去感受抽象语言带来的抽象符号背后的具体含义。

创建一个名为 callout.js 的文件。给定下面一个callout引文,请使用js代码转换成`<<callout>>`wiki调用格式。如下文所示:

```
给定文本:
> [!FAQ] Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden until it is expanded.
> the contents are hidden until
> expanded.the contents are hidden until
输出结果:
<<callout type:"faq" title:"Are callouts foldable?" src:" Yes! In a foldable callout, the contents are hidden until it is expanded.
the contents are hidden until
expanded.the contents are hidden until">>
```

js给定文本变量代码:
```js
let text = `> [!FAQ] Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden until it is expanded.
> the contents are hidden until
> expanded.the contents are hidden until`
```

需要用到的软件:

1. nodejs
2. vscode
1. F5,选择nodejs进行调试。

需要用到的语言工具:


1. string方法
1. `str.split()`。使用用于拆分的字符串或正则表达式拆分str字符串并返回一个数组。
1. `“a,b,c”.split(",")` 结果为 数组:`['a' ,'b' ,'c']`
2. `str.substring()` 从字符串中提取两个索引之间的子字符,并返回一个新的字符串。
1. let result = "Hello world!".substring(1, 4); 结果为` ell`
3. `str.toLowerCase()` 将字符串转换为小写字母。
4. `str.replace(目标字符串,想要替换的字符串 )`
1. `“a,b,c”.replace('a','bb')` 结果为 `'bb, b, c'`
2. array方法
1. `slice()` 重要函数,选取数组的一部分,并返回一个新数组。可以用来分割数组。
2. `splice()` 重要函数,用于添加或删除数组中的元素。
1. `['a' ,'b' ,'c']`,取出元素a,剩下的元素不动。
2. `let a = ['a' ,'b' ,'c'].splice(0,1)` 结果为 a 为 `['a']` 原数组为 `['b' ,'c']`
3. splice函数为左闭右开区间。
3. `push()`,向数组中末尾添加元素
4. `pop()`,移除数组中末尾元素
5. `join()` 把数组中的所有元素转换为一个字符串:
1. `['a' ,'b' ,'c'].join()` 结果为 `“a,b,c”`
6. `str.indexOf()`。**`indexOf()`** 方法返回数组中第一次出现给定元素的下标,如果不存在则返回 -1。
1. `“a,b,c”.indexOf(",")` 结果为
7. `str.includes()`。用于判断str中是否含有指定的值。返回结果为true或者false
1. `“a,b,c”..includes(“,”)` 结果为true。

JS编程知识:

```js
console.log() // 调试输出

var callout_line = "" // 变量赋值

if (条件) {条件为真的时候执行} else {条件为假的时候执行}

模版字符串(`${变量}`):
let text = 'asd'
let text_str =`你好${text}啊啊啊` //具体用法
```
7 changes: 7 additions & 0 deletions tiddlers/游戏:编程谜题.md.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
created: 20240203074019238
creator: 明玥
modified: 20240203074425484
modifier: 明玥
tags: 插件开发
title: 游戏:编程谜题
type: text/markdown

0 comments on commit b1e87ed

Please sign in to comment.