Skip to content

Commit d42b62a

Browse files
committed
chore: string
1 parent 136c330 commit d42b62a

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

README.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
- [Math & Stats](#math--stats)
5252
- [Integer Division Without Using \* or /](#integer-division-without-using--or-)
5353
- [JavaScript Fundamentals](#javascript-fundamentals)
54+
- [increment letters by 3](#increment-letters-by-3)
5455
- [How to convert -ve to +ve number?](#how-to-convert--ve-to-ve-number)
5556
- [Array slice](#array-slice)
5657
- [Math.floor](#mathfloor)
@@ -596,11 +597,25 @@ node .\src\math-and-stats\integer-division.js
596597

597598
## JavaScript Fundamentals
598599

600+
## increment letters by 3
601+
602+
Letters asci code starts from `96` to `122`.
603+
604+
- `charCodeAt()` gives the ascii code.
605+
- `String.fromCharCode(code)` converts code to string.
606+
607+
```js
608+
const letter = 'A';
609+
const newKey = (letter.charCodeAt() + 3) % 122;
610+
const result = String.fromCharCode(newKey);
611+
console.log(result); //"D"
612+
```
613+
599614
### How to convert -ve to +ve number?
600615

601616
```js
602-
Math.abs(-4) //4
603-
Math.abs(2) //2
617+
Math.abs(-4); //4
618+
Math.abs(2); //2
604619
```
605620

606621
### Array slice
@@ -672,11 +687,9 @@ Trade off or invest some memory to improve run time complexity. Suppose use Has-
672687

673688
#### Depth First Search Question
674689

675-
676690
**Category**: Graphs
677691
**Difficulty**: Easy
678692

679-
680693
<p class="codepen" data-height="265" data-theme-id="dark" data-default-tab="js,result" data-user="roopkt" data-slug-hash="MWpxezz" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="Graph: DFS Question (easy)">
681694
<span>See the Pen <a href="https://codepen.io/roopkt/pen/MWpxezz">
682695
Graph: DFS Question (easy)</a> by Rupesh Tiwari (<a href="https://codepen.io/roopkt">@roopkt</a>)

0 commit comments

Comments
 (0)