designerPdfViewer.js

    0

    0

    The function designerPdfViewer takes two arguments: the height of the tallest character in the document and the word length. It loops through the word and calculates the height of the tallest character based on its character code. If the character height is greater than the tallest character height that has been set in the function, the function sets the tallest character height to the height of the tallest character in the document.

    function designerPdfViewer(heights, word) {
      let tallestCharHeight = 0;
      let index = 0;
      for (let i = 0; i < word.length; i++) {
        index = word.charCodeAt(i) - 97;
    
        if (heights[index] > tallestCharHeight) {
          tallestCharHeight = heights[index];
        }
      }
      return tallestCharHeight * word.length;
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.