Learn JavaScript on the Now Platform: Lesson 4 - Simple Arithmetic Operators

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2025

ความคิดเห็น • 26

  • @Viikinkipastori
    @Viikinkipastori 2 ปีที่แล้ว +3

    "Now you know what it means and you will sound intelligent at cocktail parties. Because that's the value of all this education, right?"
    Love this guy!

  • @kimaly191
    @kimaly191 2 ปีที่แล้ว +4

    Best instructor EVER! Thank you so much Chuck.

  • @indiancricket1981
    @indiancricket1981 2 ปีที่แล้ว +1

    Best teacher EVER

  • @lonlandry69
    @lonlandry69 3 ปีที่แล้ว +2

    Great stuff, was not aware of Parenthesis usage in relation to mathematical order of processing.

  • @abhijitdas6496
    @abhijitdas6496 2 ปีที่แล้ว +1

    true leader. baby steps to mastery.

  • @kumarn-m3u
    @kumarn-m3u ปีที่แล้ว +2

    Increment of a (a++) cannot be stored in variable? ex: var a =12; var b = 3; var c = a++; then print c , the output is 12 instead 13.

    • @ChuckTomasi
      @ChuckTomasi ปีที่แล้ว

      Sure it can. Did I say something to the effect that it cannot?

    • @Wellwishers123
      @Wellwishers123 3 หลายเดือนก่อน

      Try c=++a

  • @theredpill7897
    @theredpill7897 4 ปีที่แล้ว +2

    I love your videos but it would be a bit better to add why we would be using this. What is the overall goal?

    • @CastroWebSolution
      @CastroWebSolution 4 ปีที่แล้ว +4

      .So Javascript is the programming language.
      .Service Now is platform IT Departments at large institutions use to manage their computers,users,departments,tickets, and much much more.
      .So Learning JavaScript is a very fundamental important skill of being a Web Developer or Programmer.
      In regards to Arithmetic Operators, is just How to use math with JavaScript. If you remember PEMDAS , then you're good.
      .When would be use a module ? ( I asked myself that once a long time ago). If there's a 100 items, and i want to split in to dozens.How many would Can i make and how many left over
      100/12 = 8.3333 (then round it down) , 100 & 12 = 4(Because 12*8=96, 100-96)
      Hope that answered some question atleast

  • @theredpill7897
    @theredpill7897 4 ปีที่แล้ว +3

    Ohh goodness. I dont know if I can learn college algebra and this at the same time...

    • @eldridgekevinm
      @eldridgekevinm 4 ปีที่แล้ว

      You can do it! Believe in yourself

  • @sumanpalisetty6096
    @sumanpalisetty6096 4 ปีที่แล้ว

    Hi Chuck, one more question please, i have 2 variables var a = 10, var b= 10, i did gs.info(a + b) and i got 1010 as javascript takes var as string by default, but when you did var a = 12 and when you performed gs.info(a + 2) why is it taking a as integer and giving 14?

    • @Hatellen
      @Hatellen 4 ปีที่แล้ว +1

      Hello! var isn't a string by default, it turns to one only if you add a string + number (e.g. "john" + 10, result: john10). In fact, if you only declare the var without a value, the type is undefined.
      In your example, the answer should be x = 20, where x is a number.
      Maybe this will help you: www.w3schools.com/js/js_variables.asp

    • @sumanpalisetty6096
      @sumanpalisetty6096 4 ปีที่แล้ว

      @@Hatellen my be I will have a second attempt Elena, thank you for letting me know that var isn't a string be default. I am a novice in JavaScript. Thank you

  • @damhoj
    @damhoj 3 ปีที่แล้ว +1

    I have run into a big problem when trying to add a value (disk size) in a flow designer "for each" logic.
    How do I get this to work: "var disk_bytes = disk_bytes + parseInt(fd_data._2__for_each.item.size_bytes);
    Return disk_bytes"
    It is in a for each logic ;-)

    • @ChuckTomasi
      @ChuckTomasi 3 ปีที่แล้ว

      The variable only has the scope of the small bit of code (note that it is enclosed in a function.) When the function is done, it goes away. Check out Flow Variables (available in Quebec.)

    • @damhoj
      @damhoj 3 ปีที่แล้ว +1

      @@ChuckTomasi it is within a flow variable in Quebec..
      And no matter what I try I get an error.
      It is in a "For Each" flowlogic I want to add disk sizes together. But it looks like Flow Designer doesn't accept math ;-)

    • @ChuckTomasi
      @ChuckTomasi 3 ปีที่แล้ว

      @@damhoj how about a simple custom action?

  • @Evilasdevil
    @Evilasdevil 2 ปีที่แล้ว

    👍

  • @AbhishekPandey-pp1lz
    @AbhishekPandey-pp1lz ปีที่แล้ว

    Case:01
    a = 1
    b = 1
    gs.info((++a + b++)*2);
    Output: 6 (why not 8 😬? )
    Case:02
    Though this will return 8
    a = 1
    b = 1
    b++
    gs.info((++a + b)*2);
    And here is 4 ? 🤔
    a = 1
    b = 1
    b - -
    gs.info((++a + b++)*2);
    takeaway from LS04 - nothing can take over parenthesis. Thanks!

  • @raehart1414
    @raehart1414 2 ปีที่แล้ว

    Would you please explain what is happening here? When I run the scripts, I get a slightly different result. For example, when Chuck runs the script:
    // Assignment
    var a = 12;
    var b = 3:
    // Addition
    gs.info(2 + 2);
    gs.info(a + 2);
    He gets: *** Script: 4
    However, I get:
    x_859663_k_s_first: 4
    x_859663_k_s_first: 14

    • @ChuckTomasi
      @ChuckTomasi 2 ปีที่แล้ว

      I got 4 when it was 2+2, but then I removed that and did a+2 and got 14. You have them both listed so your output from gs.info() is going to display both. Hope that clears things up. Watch closely starting at 01:06. :)

    • @raehart1414
      @raehart1414 2 ปีที่แล้ว

      @@ChuckTomasi Thank you!