Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b8518d

Browse files
committed
sentence to hash
1 parentb5f197b commit5b8518d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎nodejs-interview/sentence-to-hash.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
3+
This functions converts a sentence to a hash value
4+
5+
Example :
6+
Input: "What are JWT"
7+
Output: "#what-are-jwt"
8+
9+
this can be used to link questions
10+
11+
*/
12+
// | 3 | [What kind of projects are suitable to be built in go?](#what-kind-of-projects-are-suitable-to-be-built-in-go)|
13+
14+
functionhashing(num=0,str){
15+
16+
consthashed=str
17+
.trim('')
18+
.split(' ')
19+
.map((ele)=>ele.toLowerCase())
20+
.join('-')
21+
return`|${num} | [${str}?](#${hashed})`
22+
}
23+
24+
console.log(hashing(10,'What is difference between index scan and index only scan'));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp