Feeling Awesome with the JavaScript Column! - Thanks Glide

Hello Community,

How are you’ll everyone? I hope you all are fine!

I’m just experimenting the JavaScript column with some codes while I’m creating Apps and Pages in Glide and thought to share them with you’ll and correct the codes if I’m wrong in somewhere!


This is my first attempt! :

Getting the Timezone of the device!

This is the code :

var first = (new Date().toTimeString().slice(9));
var second = (Intl.DateTimeFormat().resolvedOptions().timeZone);
var third = (new Date().getTimezoneOffset() /-60);
var full = first + "," + '\xa0' + second + "," + '\xa0' + third;
return full;

My second attempt ( Part 1 ) :

First Name, dot and Last Name

image

This is the code :

var first_name = p1;
var first_name_in_capital = first_name.charAt(0).toUpperCase() + first_name.slice(1);
var last_name = p2;
var last_name_in_capital = last_name.charAt(0).toUpperCase();
var Name = first_name_in_capital + "." + last_name_in_capital;
return Name;

My second attempt ( Part 2 ) :

First Name, Last Name and dot

image

This is the code :

var first_name = p1;
var first_name_in_capital = first_name.charAt(0).toUpperCase() + first_name.slice(1);
var last_name = p2;
var last_name_in_capital = last_name.charAt(0).toUpperCase();
var Name = first_name_in_capital + "\xa0" + last_name_in_capital + ".";
return Name;

My third attempt :

Get the first letter in a word.

image

image

This is the code :

var value = p1;
var first_letter = value.charAt(0);
return first_letter;

When adding these codes add the columns for p1 or p2 or p3 and sometimes two or all!

And also I’m still learning JS in school and not have a much knowledge with it :nerd_face: If I’m wrong in somewhere please let me know :raised_hands:

I will update this post once I found new things! :raised_hands:

Thanks for reading!

Have a great day!

8 Likes

Nice choice in sample data. :wink:

1 Like

Welcome to the Code world!! :muscle:

1 Like

I started digging into js all thanks to this column) It’s a wonderful feeling when your function finally works!)

1 Like

This is the code :

var value = p1;
var first_letter = value.charAt(0);
return first_letter;

If you want to have a smaller/faster code, you just need to type …

return p1.charAt(0)

Saludos y sigue aprendiendo! :muscle:

2 Likes

One of my favorite types of columns. Allows me to transform data in a variety of ways!

2 Likes