Recursion
1. What is Recursive Function?
// Conditional statement that returns 0 when an empty array is received // Code that solves the smallest problem & code that stops recursion function arrSum(arr) { if (arr.length === 0) { return 0; } // First element of array + arrSum function that receives array with remaining elements // Code that breaks down the problem through recursion // arrSum([5]) === 5 + arrSum([]) === 5 + 0 === 5; // arrSum([4, 5]) === 4 + arrSum([5]) === 4 + 5 === 9; return arr.shift() + arrSum(arr); }
2. Recursive Thinking
1. Define the input and output of the recursive function
2. Break down the problem and divide into cases
3. Solve simple problems
4. Solve complex problems
5. Implement the code
3.JSON.stringigy
1. Background of JSON Creation
2. Methods
JSON.stringify: Method to convert object β JSON
JSON.stringify: Method to convert object β JSONJSON.parse: Method to convert JSON β object
JSON.parse: Method to convert JSON β object3. JSON Basic Rules

Last updated