Get acronym using Lambda
I'm trying to get the acronym of the text variable with a Lambda function
var str = $this;
var matches = str.match(/\b(\w)/g); // ['J','S','O','N']
var acronym = matches.join(''); // JSON
return(acronym)
The function doesn't work with $this.
I've used (return $this;) and I've successfully got a result. This means the variable is available.
Please guide me where I am doing wrong
Answers
-
Is your code all in one line in the editor? If yes then your comment is commenting the rest of the code.
Quick test: try to remove the comments.
-
This doesn't help, unfortunately. I'm still getting Cannot read properties of null (reading 'join')
-
I've got working JS
var str = $this;
let acronym = str.split(/\s/).reduce((response,word)=> response+=word.slice(0,1),'')
return(acronym)
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback