Inside the Barrel - ServiceNow Tokyo Release ES12 Exploration
hi and welcome to another episode of inside the barrel this time with dorian and we're going to be talking about es12 in tokyo on servicenow all right yeah yeah definitely a super awesome topic um last week they did the the half the live coding happy hour on it and so earl and team just dove right in did a ton of examples and really showed some cool stuff with business rules and showing it working i figured we'll just you know continue where they left off show some cool things answer some questions and kind of explore it together sweet hey is that your new chair this is my new chair nice but but i can still i can do that you know the standing desk as well if we really want it look at you yeah i'm standing i i i feel like it does it works better for me to to do the standing while we do these shows because it just i don't know my desk is so wiggly i mean look at that yeah i feel like my mind wiggles too so [Laughter] so i figured i'll kind of start us off i'll do some background scripts and scope dabs and then if you maybe if we have time we'll do some widget stuff as well to kind of see how all that works yeah yeah yeah cool so uh a couple things to kind of get people started uh what is es6 if they've heard that term or es7 8 9 10 11 12. wait wait what about emacs yeah so yes it's just the short version for the the emac but emac and it's like 2015 and that it happens every year so 2016 2017 2018 the downside is the years don't actually perfectly line up so like es12 you would think it'd be oh 2022 but it's actually 21. so that that may just be a little confusing um but uh essentially what what this this big feature is really about is for the longest time servicenow behind the scenes uses rhino and rhino supports up to the emac 2015 standard and in the 2016 and beyond so es6 and beyond the standard uh changed a lot and yes and so that pretty much made like a lot of the stack overflow stuff out of date i mean they they pretty much brought a lot of the good stuff from java from other languages into the the official uh emac standard so the official standard of javascript um and so we'll kind of show what i'll first do is show you where can you find good information you know speaking of that trying to you're right trying to find stuff you're like typing in vanilla js or just plain js trying to figure out how to write scripts to do things because you know um i think you turned me on to this a while ago the uh what was it uh battlefish yeah yeah babel and then and then they discontinued the es the old es stuff so you couldn't you couldn't uh convert it i think it was oh i can't spell transpiler but i think it was yeah like it was something like this right where you could you know write code and but they disabled a couple of the older ones older ones yeah and so you couldn't it's really good and it's still useful um yeah it's probably less useful or it's not as much needed because servicenow said every year they're going to update this so really super awesome because a lot of the infrastructure they built um so rather than waiting for rhino they essentially built their own compiler that will oh nice they'll try to keep up with it oh that's really great and so we'll kind of just start with some docs and i'll put this in the um uh in the link in the description but like here's a great one that tells you the difference between six and five so if you ever wanted to like find a new thing in six or you're like let me just kind of explore and we'll use a couple of these examples like you know constants right like it actually shows you how you would have done it in in five um and also in six so um so this is a really good one the es6 features it only has es6 features so there's actually more than that um in the newest one so here's another one and it's a little hard to read sometimes but essentially it goes from five so if you if we look at five features these are you know five features and this is from 2015. when you go into six right they have a ton of new ones and i don't actually know which engine service now uses but i i don't think that's going to apply in most cases for everybody or it's going to be an issue but then you can see like there's new things past 2016 that you also get access to um and so we'll we'll talk about that so this is like a really good one and probably the best one that i've found is there's this github page um by sudden i i don't know who said is but he has this awesome cheat sheet which goes through each of it tells you the dates that they've come out um and so notice here that like es10 that the uh um the numbering isn't the same but it goes through an example like if you wanted to use arrow functions yeah arrow functions and they just kind of give you an example um and what's super awesome and i'll show you we'll just copy this into background scripts and and play around with it to test so uh and then lastly just if you want to learn about the class syntax because classes are kind of an interesting thing that we'll talk about um especially because we did this whole like five part thing on script includes this brings like another option that you could start using and that's using out of the box javascript classes so we'll throw an example in there so i'll throw these in the description but these are the ones that i find are the most useful um so so yeah so let's jump right in uh i'm gonna skip the part where you actually create a scoped app but so this currently only works in scoped apps and we'll show you how you can turn that on a lot there's going to be lots of documentation on lots of people telling you how to turn it on once you've already created an app either a new one or on a tokyo instance you can open the app and then go to settings and inside the application settings you will see the option to switch it to uh to 2021 version and in the future it'll be like a yes 13 14 15 like so they'll release those as we go that's it once you turn that on it should be backwards compatible and it also should support future future features it may not support everything so i think in the in the live coding happy hour they talked about promises won't be supported and i think that's okay knowing that um most of this transpiles to the evm and into java and they they do a pretty good job of telling you what is sync and what's not sync in service now um so one thing that they didn't get to show on the live coding happy hour was how would we use this in global and so let's say you wanted to to have your to write some uh to utilize some es12 things in global well what you could do is create a scoped app create a script include and then just set the accessible from all application scopes so when you do this this every time you call you know your scope thing it will run and so that'll let's do that as our first test so essentially what i have here is while you're showing that i just want to shout out again to my favorite person arnold with snutils oh you don't have it installed i do have it installed this is that's definitely it where's your link though you should have a link up there where it says run script that uh lets you open it in via studio uh maybe version one run and it lets you save it real time and run it from via studio i mean it'll show the results here on this page but it's pretty pretty handy yeah so let's let's go with um uh testing this so awesome my function awesome and so i wrote this you know script called awesome and all this is doing is in this function cool i'm using an es12 feature so not even just an es6 that this is replace all essentially replace all find any word all and replace it with the word most of and then just output it so relatively simple so we're going to do and john is not telling me how to keep up with chat uh hey guys um so awesome and it didn't take and uh it was a function and then we had a function called cool right so right awesome function called cool no variables we're going to minimize that for now and we're going to run it first and hit scope and it replaced the word all all over the place now we're going to change scopes to global now we're in global so imagine you have a business rule or something in global and you want to access some of the esl features and oh well that's because this part isn't and here we go so i can still do the the same thing um and so that that just shows you a way that like even though it's not accessible directly in global as you saw from my little error there you can write all your codes in a scoped app you can even call it like your you know es12 scripts or something like that that's awesome that i can see how that would be super handy um yeah yeah and so let's if if we can what i'll do is let's dive into a little bit of some the class object because what we've shown here is this is the default way you normally do classes but prototypes is actually a very old-school way of doing things versus just using a class so if you remember from some of our older videos we essentially we essentially showed you different methods or different ways that you can you know write script includes and so here's an example where we actually are creating a class and the constructor if you've never used java or javascript javascript further is essentially the like initialize method or the methods that essentially you can you can call with this and and then there's notions of setters and getters so the idea is you can set a value or set a part of the object so this would be setting the width this is this is the way you would get the width um setting a height getting the height and then you can now get the area so this class is a rectangle and we want to you know you know do all of these things with it and so i'll walk through what what we have here first a really fun thing to note is before you could have a bunch of vars that had the same name in es12 it'll tell you an error it's saying hey you've defined this multiple times so [Music] like don't do that so so that's that's good um for for sanity purposes so in this case what i'm doing is i'm using that constructor of width and height right here um and passing it in cool was the name of this and i'm just passing in the the width and the height of two and four and then i'm going to print out the width and the height and then i'm going to say is the area of this rectangle so is it is this math of multiplying width times height equal equal to a thousand it's going to return false then i'm going to show you how those sets and gets work so notice here all i'm doing is just dot like it's kind of like that dot notation because of set and get is special when you do have sets and gets you can just directly set them and then i'm going to check if the area is is the same again does that does that kind of make sense sean yeah yeah and um is there a reason why you use the triple evaluator like are you i know that it evaluates on the value and the type yeah that's that's essentially why i was using it but like i can i could do that for you well it doesn't matter to me i only brought it up just in case other people weren't sure what the triple equal signs represents and how it works yeah totally um and so uh here here's where we ran it notice i passed in a two and a four that's why the width and the height is that i checked if the uh the area is a thousand it wasn't then i set using those setter functions um then to be 50 and 20 and now i get a thousand which is results in true and you can see that now that object has been has been set um and then i just printed out what that object looks like so you can kind of see it right so that's an example of how you could write script includes create classes javascript classes and then call and utilize those i find it humorous that you use boo also it's one of those things i'm always like sending up just to make sure something's responding yeah i love it um so yeah so that's kind of that's kind of in a nutshell you know we talked a little bit about the script includes on how you can actually use classes now which is which is really awesome we talked about how if even if you just use the old school one and we showed our first you know using es12 uh example so now what i was kind of going to go through is just some other cool stuff that you can use now um so so the first one is around uh and i'll show it up here is these block scoped variables and so what that means is essentially if you set a up here and then you try to set it here it's going to say that this a is different so this a is going to be set um but it's going to be a different place in memory than this a with me john oh because it's encapsulated in that if statement in that if statement so it's it's blocked so if i run this oh let me let me cancel some of these to make things easier for us right so notice that the two is there and the ones there and just in case you're you haven't seen javascript at all let and cons are the new things um let's are essentially pointers that allow you to change that the the value of them cons would would make it immutable and then you can't change it so most times you want to use cons if like you're just defining something and it's never going to change and then use let if that value is constantly going to be changing so yep so that's kind of blocked and it's also similar for not only variables but functions and this is like super gnarly like you have a function foo returns one it checks it and then within you know some some sort of brackets or something you write foo again and return it it's going to return true here and then this is going to return true again um so because this one is is blocked so i wouldn't recommend uh utilizing these things yes but just know that that you may start seeing different experiences if you aren't correctly taking into account block scopes um so moving along uh a nice you know just quick and easy new feature in es12 um is this replace all so if you ever wanted to you had a string and you wanted to replace it all which we which i showed in that other script uh you can now uh utilize you know really easy function so instead of all of the world's age most of the world stage right so yeah i think what you used to have to like either loop through it with the replace or do some sort of regex to find them all and so that is nice a single line yeah and it's not in this one it's in let's go back to the top and let's find it in here so look at us using this stock replace all yeah yeah so before it you'd have to do like a replace and you know red exit or yep um but this is just replace all i know i i yes i'm so excited about that one because i've had to do so many so many regexes to replace yeah uh so let's get into like some mind bender stuff [Music] and falsely so uh we'll do a little quiz john have you ever seen this no that is that is a new one to me what is that and so there's also just to show there's the the or or equals oh boy and this looks fine and so what this is saying is return this uh return this value or set this value if the thing if if this on the left hand side is uh is is truthy so if empty string is truthy set it to bar correct and so empty string is falsy right and i didn't make up these words [Laughter] so in this case it will return uh the empty string because it's falsy so it's a shorthand way of doing an if statement really or a tertiary i guess a ternary yeah okay and then but foo for example in this case is truthy right um so it's gonna it's gonna set it to bar and then it's kind of guess go ahead well i was just gonna say i'm guessing the uh or the or or equals is just opposite of that if it's truthy said it yep okay yeah if if one of these things are truthy uh set the truth the option essentially right and if if it's the first one it'll set the first if it's the second it sets the second so mindbender one i know um well but it's it's not really it's just easier way to write an if statement to check truth or non truth yeah and truthy and falsey is useful because a lot of the times you'll see expressions where it's like if it exists and and it's uh not an empty string and right yes yeah type of object is right like you wrote you had to write these all these if statements with a lot of different checks in order to kind of keep it yeah yeah or you'd start you'd start uh grouping them like you know is it not empty and then do another group inside of that just because you didn't want to load it all up in one line because your elses may have gotten messed up you know so this one's a little fun one you can't use commas you can have really big numbers um so i think this is called a big uh something i don't know if it's big number big int yeah big float no it's oh man i can't remember which one uh uh numeric separators that's what this one's called so essentially what this is saying is if you need to write a really big number uh you can use an underscore to separate it and it will still keep the actual number why would i need that no in english when you write 9000 it has a comma in it right this is saying like separate on on these parts is that just readability really for you as a you know as you're looking at the code is that um yes okay here you go all right they're very helpful to read large numbers [Laughter] because i was just wondering i was sitting there i'm like when would i use this i guess if i have a really large number i need to know if it's a billion or a trillion or you know whatever comes after that i guess i think it's like if you're thinking of it like you know if you write milliseconds a lot like being able to know if it's a millisecond or a nanosecond i feel like this stems from someone getting really annoyed at large numbers they're just sitting there one day going man this is dumb i need a way to separate this so i know what i'm working totally um um what it was this one so this was another one for oh match all nice natural yes okay um and essentially what this will return got to go to our handy match like this site is so awesome uh so essentially what this is doing is it allows you to i mean there's a couple things this array from right and the arrow we're using but uh the idea is it will match all of the the uh the groups so right it's gonna match you know these four groups in this case based on this regex and then you can do something with that right you can write a little quick function that you know uh checks um you know each part of the array and then prints it right so um so that's all this is doing and you'll see that it returned those those four for if you need to get all of the successful matches so that was some you know quick you know and honestly like we could we could go through this like whole thing if there's something specific that you wanted to talk about like if we train we should look at error the arrow functions i know this has come up in cask there's there's different opinions on arrow functions yeah so i'll show you what this talks about for arrow functions and we could just just show you the the ease of it so arrow functions are essentially an easier way or a more stylized way to write functions okay um so normally you would have some expression like this so this is like previously es25 where you you name the function you say it's a function you pass in the variables and then you do some sort of return the arrow function is saying hey we don't need all that boilerplate we already know that you're going to create a function you're just going to tell us how many variables it has or what the variables is and then you're going to tell me what it does so this is um one example this is probably the an easy one so let's let's just let's just copy this in to kind of use this as our example um right and just know every time you see console.log just change it with gsf.info so so yeah so that works now what's a really cool thing is if you only had one uh variable you don't even need these parens anymore so you could do something like that so if you have a static value yeah okay yeah [Music] or or you're doing other things like if you just have one variable you don't need the the parens and so that will that'll work as well so that's you know one variation of that um so you probably will see lots of variations and here is a great let's list out all the variations right uh so we kind of showed i just showed this one right like if you have one variable you just need to have it notice there's no return here if you have multiple parameters but a single statement so we that was our first example so we've shown both of these if you have a single parameter and multiple statements so we have uh we we have this one right so what this is saying is the biggest difference here is still the one parameter is first and then we're showing we're putting it all in in brackets to to say that this is now the body that we're going to work on it's no longer a single statement and then it's just looks like any other function right imagine this is the start of your function so let's copy this one and oh while you're writing that out dimitri sena or dimitar sent us a a message and and yeah you're correct it will be much easier to use stack overflow now um because yeah instead of trying to find all the make sure your dates are like pre-2015 yeah that's definitely it's gonna save so much time uh for for people yeah so let's just change these gs infos i feel like i just need to create a browser extension at any time i see console.log so you know you say that someone uh someone on linkedin turned me on to user scripts in the browser um i haven't had a chance to really get into them but they seem really cool so this is i think this is totally something you can do with a user script to just do that for you yep so here is you know still a valid you know case right we're passing in five if the five mod two so that's using the the mod function checks if there's a remainder or not if there is a remainder then it's odd if there's no remainder it's even so but this is actually wrong right so if if mod 2 is no that's zero yeah if you passed in a four it would come out even if you passed f5 it should come out odd yeah it looks like oh it says so i don't know if this example code wait why why would it this is returning zero though that's why i don't understand why they wrote this one this way so this returns like zero right so like if you like if you just do gs info five oh that should return one yeah i was gonna say that one is true and then it's saying that it's even but that's not the case that we want that's broken why is that broken because that should be this should uh this should be odd no no it shouldn't be it should be even write it out as a normal function and see if it works no but like i i'm already showing like so like var uh yeah no i i get it it should be it should have come out as and then if you know uh odd oh wait so this is a one actually i'm just going to print foo so this is if if this is one it should return this else yeah but that's written differently than the the other one though i think right like i think the issue is like the this is returning one and they didn't account for that and if it returns one it's not an even number it's only zero is it an even number so this should be like it should be uh because because one is truthy right because if you do one here right yeah if if it if cause zero is falsy you're false yeah so i wouldn't worry too much about like [Laughter] you should seem you should send sud a remark and say hey your your uh example is broken i mean it'll work with other ones right but it's just like i don't know why he chose that one okay so multiple parameters and multiple statements it's pretty much identical to the previous one except you just need to remember to put brackets or prints around it right so relatively relatively simple there and no parameters right well i like how he says multiple parameters and multiple statements but there's really only one statement i wouldn't move this multiple line oh oh okay yeah but there's two segments right there's a check here and then a return here right okay i'll i'll give you that yeah so so that's kind of the arrow function super cool yeah should make your life easier it once you do five ten fifteen of them it'll it'll kind of come naturally to you well i think that's what's gonna happen you know uh by by the midpoint so whenever you know uh six months after tokyo release i think you're going to start seeing a a huge change in what people are writing yeah well even even servicenow i'm surprised they haven't started it but i think you're going to see this change it's just going to the whole you know the whole ecosystem is just going to shift and everyone's going to follow suit and it's going to be awesome that's just going to take some learning curves right yeah so we could going down the list and enhance object literals so before if you wanted to instantiate something like this yeah for an object you'd have to set the key and the value but in this case you just need to to set it and it will it'll know it as long as you're as long as your keys are the same right correct yeah if you want a to be a b to b b c to b c yeah um but normally you see this a lot with like object properties are often created with the same name right so that's to kind of keep track of that so so let me ask you this dorian how much or how many times or how long do you get stuck on naming things yeah that one's a good one i mean i go back and forth i think if uh memory issues were a thing then like you get to like hardcore performance people like name things super small yet a little bit relevant and it really depends if the thing that you're you're naming is actually super important then it should have a good name if it's only being used temporary in one place it actually doesn't matter what the name is so like that's kind of well yeah i just yeah i see this as helping some of that because there are times where i'll get just i'll just be like i'll go blank i can't come up with a proper key you know and i'm just like oh come on yeah this sure does help that for sure um [Music] what else um oh in an object so there's a lot of changes within like objects gotta enhance right so within an object if you needed to have a function um you can you can now like make that look a lot cleaner um so rather than saying it's a function you just you write the the key or what would normally be like a key right as the the function and the variables and then it's you know the same parts the same on the return so they just drop the word function remove the colon [Music] what other yeah well i was going to ask did they do anything with looping because i think looping is a big a big performance thing that we get caught up on in servicenow especially on the server side because we don't we we don't normally have access to some of the helpers like you know uh underscore or low lodash um yeah so i'll go over that one shortly the the thing i wanted to touch that's super awesome is literally like template literals like oh yeah yeah have we had to i'll just copy and paste this one this one's like how many times have we had to write a multi-line statement i'm thinking i'm talking to you mail templates like it was like john and then it was like first name plus equals something else you know and plus equals plus equals plus equals and oh my gosh yes you wanted to just write and then there's like the new line the famous new line you know somewhere in there i know marco who's on has has seen this before and now you could just use uh template literals so um so essentially you know if you wanted to write a multi-line or you wanted to like have a variable inside of this um that's already that's already sex oh you don't have to do you don't have to do um the terminator plus and the plus sign okay so nice [Music] multi-line right and use your variable oh my gosh objects as well well something i don't know either i lost john or i got lost they get i don't know if i lost john or not a glitch in the matrix yeah all right so i i think i'm still here all right john's back all right you know it's it's always that way i think i think probably one of my kids is home on the internet playing games yeah yeah [Music] yes the rationator a glitch in the matrix and uh so yeah so that's kind of you know just going to be super useful like yes being able to write one line thing without a bunch of pluses in it like even if it was just like a one-liner like this like super awesome use the back ticks um and and totally uh do the the at symbol there um are you you're not showing are you oh no i wasn't but [Music] yeah so super awesome hey look it even talks a little bit about css and javascript right um wow you can do some cool things like that um uh i'm not going to go into destructuring that's like a whole topic on you know if you needed to extract values from from objects right so like if you wanted to if you had a user object here [Music] and you wanted to like essentially extract a key from it you can set a variable to be that key and then you could extract that one same thing in um uh in setting arrays so think of this as like i mean just the quick thing here um think of destruct destructuring as like i know i'm gonna need these variables so when you're instantiating it or you're setting it up already set those so that you can then access it so kind of keep that in mind with um with the structuring so definitely a shorthand good one so yeah no that is nice so you wanted to jump into looping yes yes i think this is a big one that i find i'm doing a lot of and i can see the performance hits as you know the more you do and the more records you get the bigger problems you run into uh default params i think someone else talked about this oh the the rest parameter this or the spread operator we could we could talk about that at some point the spread operator so i don't know if you're going to get a ton of performance things but there's a couple things that we could we could talk about um because there's like symbols there's maps there's sets there's there's there's obviously the array uh yeah i think map was already available to some extent we but i don't remember it being available within server scripts i know i did use it in client scripts quite a few quite a bit it wasn't clients but it wasn't available in in server side so okay and that's i mean this is like a super easy test right because i love it it's like all right all right so we'll see if this just uh or let because cons can still work so that that works we switch to global bam oh wait uh let's go far yep so won't let you only do a map um so so yeah so definitely some you'll definitely get performance improvements from maps and there are special things about maps that are different than uh than arrays and i think it was in the live coding happy hour they talked about the four so normally when you used to write a function it was something like uh equals uh your keyboard is so clickety clackety [Laughter] what what kind of switches are they they're they're blue switches yeah didn't want to go with the cherries no but they're very satisfying [Laughter] so what do you think this is gonna [Music] return uh well game show test yeah it should give me the iterator the i want to say the keys but i don't remember that is es25 answer so this uh so yeah so zero one and two so you got your so basically the indexes or the yeah the iterators um i think actually let me see if that doesn't run any difference so they did make a change uh on this one so that it will return that the actual value um but uh i don't remember which which for loop that is for of uh that's it that's it there we go so oh nice and this won't work in uh oh yeah so that that won't work in that for loop um but it will work in in there but this one does still work but you can can you get if you're doing the of can you get the uh like if you do um what is it l and then square brackets uh foo you'll get um yeah do a square bracket with who on that i think so that's how you would would normally do that right yeah i just want to see if that still works that way because i find myself doing that occasionally too so that won't work in this case oh right because foo of a right i mean we could we could cheat here and do like oh set the set the iterators like but that's only a very small example and don't please don't write this code it's gonna definitely complete someone so definitely definitely don't write it like this um but so um what else uh we get access to generators um not super good about those i'm gonna skip over probably very easy oh let's talk about sets yeah let's do sets this one is like really useful for duplicates right so if you ever i feel like there's been so many times where it's like i just got a bunch of records and then i need to generate an array with certain values in it and then i need those to be unique and then i would have to normally do like an if statement that checks if the value already exists in the array before adding it to the array so set just makes it like super easy um because you get access to some fun things with set so we have this set and i just need to console [Music] all right so essentially it's if we were doing an array it would add the two right multiple times um it couldn't it would also probably yell at you trying to to add an object and it actually probably wouldn't no you can you can add objects into an array pretty easily um but this gives you a really nice way of checking the size i guess that's similar to array.length so nothing but if you wanted to just see if a value exists very simple as does so i'm going to get i'm going to get caught up on size here um is size available to an object like if i if i instantiate an object can i do object.size so you're talking about this object yep and then uh and then size right that's what you want to know yeah yeah um i don't think size works on on objects yeah that's too bad just on arrays or just on sets uh it also works i think on on maps so we could we could try that new map and i can't keep variables the same uh yep so we could do uh [Music] um maybe size is something there's probably maybe something different for it okay that's fine i i was just curious because you know object lengths sometimes are you know you gotta pro you gotta process through the object get a length on it or to know what's in it yeah i actually don't think i could json stringify a map so we'll see if this yells at me oh i can't nice well what is a map is it basically an object or an array what is it it's very similar like i think this was i think earl did a pretty good job of uh explaining it um oh wow this one is like mean it makes me go through everything all right whatever that's fine um yeah so so the cool thing about maps is the keys don't have to be like a string right so like a key can be an object um it could be you know another map so normally when that's like one big difference and then the order is preserved so in a map like remember a json object you can never trust you know what order it comes in but maps you can always trust the way they they come so um so that's kind of the quick one on that um what else we got a weak set that's cool oh here is maps oh there we go here was your keys for it um and they even showed an example of inverses of weak maps any other um there's probably symbols which are which are probably good symbols essentially enforce uniqueness um so you can once something is instantiated and as as a symbol then it will always if you try to compare that to another thing that also looks like the same symbol it won't it won't work so um so like here's an example right it creates a symbol of foo and checking if it's a another if it's equal to the symbol of foo that won't what's interesting so this is useful if you really need to check uniqueness of an object um versus something newly created that looks like that object okay you know saying it that way i can see that i'm i may actually use that because there are times where i compare objects you know like when you're returning a record set you want to make sure it's a different record yeah yeah yep so that that that could that could be useful for you for you know uniquely identifying um those um so yeah do you maybe you want to show we have a few minutes you know getting some of this to work in a portal widget yeah did you let's see will you send me that link to that that page so i can copy out some of those yeah let me make sure my widget is still up and i i will put all these links in the description as well so highly recommend just keeping it bookmarked it's even if like you're like some code for the first time you don't understand it you could just like control find something here and it they do a decent job of trying to explain it so yeah there's so much yeah no i i am definitely bookmarking this guy um there's parseint i feel like we used parsint a lot there's probably something new did parsons get changed or is it still the same uh it's still the same yeah still the same i think servicenow have made their own person as well oh we got includes that one works oh that was finally i feel like this would work sometimes i don't know if anyone's ever tried like includes used to work you know some of these times but it really didn't uh no more index of john oh do you know how nice and i know it's just kind of a shorthand way of writing but man that is so nice i would have to constantly ask myself does index of equal equal negative one like it was just like this i i always did what did i do i always did like greater than or equal to zero because i i don't i don't trust negative one i always feel like it's a string or something so i never trust it oh and it works on man's interesting yeah but i don't know if we get access to nan's oh well you can always check yeah i don't think i don't think that's gonna work in servicenow but you're right super easy while you're getting setting up let's try some vans hey yeah maybe that does work but servicenow does a really good job of returning undefined a lot yeah yeah um yeah sedans are supported sweet was nance always supported i don't know what broke with this i was like was nan supported here the here's the equivalent so we could we could test that i'm glad he gives the equivalent because it helps you read it and go you know what this is how i used to write it now i can write it this new way and see it yeah totally because that was nice about babel is you would just toss in your code and it would convert it for you but you could see how the new way compared against your old way negative one was dan was supported okay nice i feel like i've never used nan i've always just used undefined and just kind of looking through other ones i like you know object values um some of this object stuff is quite handy that i wish was a va like i i i've run into times where using like object values or object. what is it keys and stuff like that are problematic you know you can't you can't really use it on the server side but it's so handy to have available so so this one probably is is definitely useful right because i feel like we've always done four for loops right over objects so you can now it looks like you can get values really easily you can get entries you know the whole thing yeah really this object stuff is going to make a huge difference yep especially on the portal side um because like i said i run into this a lot oh this is cool with like credit card stuff string padding i don't know if you've ever used that one oh that is nice um you wanted to like mask some stuff yeah i guess if if your company's storing credit [Music] that's a whole different that's a whole different ball game though and but it's nice to have padding though i mean it doesn't have to be just card numbers but just think about you know maybe there's something to do with employee numbers that you only want to see the last four or something like that you know yeah and so it's sad that promises are not supported i i agree um but i feel like it's just promises are going to add so much complication um to the state management of servicenow that i'm kind of okay that they aren't there for now if you want to do like async stuff it's like set it and forget it and it's just like throw off a spin off a thread and you know some hierarchical worker are you ready john yeah yeah we can do some stuff do you want to share yeah we can do that we only have a minute so maybe just throw up the screen and we'll do one quick one all right let me get it as an actual its own thing i think the only big one we didn't do is spread operators but just like looking there's also flat maps okay uh let's see there we go all right screen is like i feel like i'm blind trying to to see this oh oh john john's crashed so we'll we'll go back to mine but she broke i didn't talk about flat maps just some nice useful things rather than just reducing and concat and it's up here yeah well you're you're back john i moved this did me i mean yeah it's okay um yeah i think i mean honestly i think we did good maybe we do another session on you know portal widgets and yeah we can do that i think that's totally fine there's probably some fun trimming it looks like there's some options oh what's in trimming um you can just trim left or trim right oh nice so i missed you know when i came i used to do a lot of php full stack development and and the trimming that php had was so nice because you could do trim left or trim right you know it was so handy i always missed that uh we could do some sorting some erase sorting well as a function that's cool well you could do that before you just had to set it all up yeah um it supports more json things like with the use you characters interesting i don't actually know if this private class variables will actually work but that that would be kind of cool big end john i know you needed these big ends then i can use the uh the separator in that so i don't so i don't get annoyed at the big numbers right yeah i actually don't know if big n will work um yeah we could we could try this uh i i don't know if they will support big ends i mean it's kind of looking like it um uh nope no big in for you john well i'll have to keep my numbers short yeah i think it's okay payroll will be upset right when we can't use big numbers i mean these are really really big numbers [Laughter] um knowledge cascading i mean there's probably some cool stuff here um um yeah so that i think that's i think we're in a good place yeah there's there's definitely a lot happening a lot going on with all this new uh javascript stuff for sure um i'm excited i'm happy for it because i think this is gonna really help what was your favorite uh what was my favorite well that's hard to say i really surprised you the most those are my two questions oh i guess that includes thing was kind of a i didn't expect that to happen because i mean index of is easy enough to write on its own but includes just makes it that much easier because i always you know so i'll go back to like when i bought my first uh programming book the first pair like the you open the book and the first page was like hey developers are inherently lazy that's how they work the best because they build things to make their lives easier and so i see includes being some some guy there working on javascript was like this index of is too too much for me i'm going to create includes and make my life easier i think the most surprising one for me was the like truthy falsey one yeah or equals like i think i would constantly need a mind bender to think about it like what is this supposed to return yeah i could see that yeah i think um i was trying to think the other other ones that i think i'll use the most i think the arrow function really will be like you know or this the the template literals like i really despise the plus everywhere so i think the the backtick is going to be a nice addition um yeah it is i agree um [Music] just because you know something i was working on currently is really going to change over that the problem is it's it's global and so i have to wait a little while on that one but uh i think that makes a huge difference when you're trying to put together stuff because you still use it on you know on widgets and whatnot sometimes when you're building out a long message you know and i i can see this being so much easier but i wonder if it's going to conflict though because you already in you're already kind of well i don't know male scripts mail scripts yeah like the amount of print 10 lines you needed on that like oh my god yeah i could see that yeah that that's going to be a boon for people working in mouse grips see i i don't ever it's you know it's been a long time since i've done a mouse script so to me it's not on the top of my head but if you're in there building all those things it's always the first thing they're like we want an awesome notification email and you're like all right time to get back to coding well but it's even yeah it's like old school stuff too because then you're oh man i hate notifications i'll just put that out there because you're you know email emails themselves are the worst to try to make look pretty because it's all it's all ie six based or five days in line crap and you're just like oh my head hurts yeah yeah all right well we'll see you all next week we got some fun things planned for the rest of the month so stay tuned yeah we'll catch you guys soon we'll see you i get a job oh perfect it's the wrong job and shout out to all of our commenters uh here thank you for for participating we appreciate that and hope to see you again [Music] you
https://www.youtube.com/watch?v=-L-oiPqzjbg