We do not inject data. We inject behavior and resources (functions and streams).
✅ Inject what does the work ❌ Do NOT inject the result of the work
Extend the existing to-do application to support multiple todo lists. Users should be able to create and manage separate lists, each with its own set of todo items.
Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: hollow-diamond.
For this assignment, the style parameter will be "hollow-diamond", and the dimensions parameter will be an array containing a single number [size] where:
size specifies the width and height of the diamond (both are the same).size:Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: diamond.
For this assignment, the style parameter will be "diamond", and the dimensions parameter will be an array containing a single number [size] where:
size specifies the width and height of the diamond (both are the same).size:Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: right-aligned-triangle.
For this assignment, the style parameter will be "right-aligned-triangle", and the dimensions parameter will be an array containing a single number [size] where:
size specifies the number of rows in the triangle.* characters are preceded by spaces ( ) to align them to the right edge of the triangle.Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: triangle.
For this assignment, the style parameter will be "triangle", and the dimensions parameter will be an array containing a single number [size] where:
size specifies the number of rows in the triangle.*, the 2nd row has 2 *, and so on.Your task is to extend the functionality of the generatePattern(style, dimensions) function to support a new pattern type: alternating rectangle.
For this assignment, the style parameter will be "alternating-rectangle", and the dimensions parameter will be an array [columns, rows] where:
columns is the number of columns in the rectangle.rows is the number of rows in the rectangle.Early exits are a coding technique where we return from a function as soon as we encounter a condition that prevents further execution. This approach simplifies code, improves readability, and can enhance performance by avoiding unnecessary computations.
function occurrences(string, substring) {
const lastIndex = string.length - substring.length;
const isSubstringEmpty = !substring;
let subStringCount = 0;