vikkktor

Arrays_reverseString

Sep 28th, 2021 (edited)
764
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(string) {
  2.  
  3.     let str = string
  4.     let strL = string.length
  5.     //debug:
  6.     //console.log(str)
  7.     //console.log(strL)
  8.  
  9.     let i = 0
  10.     let revStr = ""
  11.     while (strL > i) {
  12.         revStr += (str[strL-1])
  13.         strL--
  14.     }
  15.  
  16.     console.log(revStr)
  17. }
  18.  
  19. solve("Hello")
  20. solve("SoftUni")
  21. solve("1234")
RAW Paste Data