繁安
繁安

喜歡開發腦洞,如果能讓你對人生有新的啟發,會是我最大的榮幸。 #心靈治愈 #星盤 #普通分享 #隨筆 #自學前端ing

怎麼問Chatgpt獲得清晰回答-JS argument 與parameter的分別

怎麼問Chatgpt獲得清晰回答?回想日常的思考模式與記錄筆記模式,指引chatgpt用同等方式;回答切換語言,使用自己能理解的方式而不一定要用習慣的語言;用例子來加強印象跟延伸解釋;一直問到理解為止

怎麼問Chatgpt獲得清晰回答

  1. 回想日常的思考模式與記錄筆記模式,指引chatgpt用同等方式回答
  2. 切換語言,使用自己能理解的方式而不一定要用習慣的語言
  3. 用例子來加強印象跟延伸解釋
  4. 一直問到理解為止
例子:我一直不是很能理解argument vs parameter的分別,還有不少詞彙看到文章經常使用但也不太理解,所以詢問Chatgpt

第一次問完之後,Chatgpt以段落的方式給我一段解釋,看完還是很懵,畢竟本來就不懂,不懂的東西用大段文字連看都不想看。

第二次嘗試讓它用中文解釋,名詞根本看不懂。

第三次用我習慣的point form配上例子,終於看懂了。

Here are some points to explain the difference between parameters and arguments in programming, with examples:
Parameters:
- Parameters are variables declared in a function definition.
They act as placeholders that will be assigned values when the function is called.
- They are enclosed in parentheses after the function name.
- Parameters are used to define the function signature.

For example, in the following function definition, "x" and "y" are parameters:
function addNumbers(x, y) {
  return x + y;
}

Arguments:
- Arguments are the actual values passed to a function when it is called.
- They are passed to the function as inputs when it is invoked.
Arguments are assigned to the corresponding parameters in the function definition.
- Arguments are enclosed in parentheses after the function name when it is called.

For example, in the following function call, "2" and "3" are arguments:
addNumbers(2, 3);

In this case, "2" will be assigned to the "x" parameter, and "3" will be assigned to the "y" parameter. The function will then return the sum of the two arguments, which is 5.

So, in summary, parameters are variables declared in a function definition, while arguments are the values passed to a function when it is called. The parameters act as placeholders for the arguments, which are assigned to them when the function is invoked.
CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

Loading...

Comment