Having hard time changing psuedo script to Javascript

Is there any tutors available? I want to learn coding, but continually making mistakes in the process. Here’s a for example:

let (is_arpeggio_ascending)

let (myArp = ascending) {

    for(let 'i = 0'; 'i< answer.length';'i++');

     if ('i of myArp' > 'i + 1 of myArp');

     console.log(is_not_ascending);

} else {

     console.log(is_ascending);

}

Here’s another example:

function do_something(in_string){

    (let a = 1; b = "");

    for

        if  in_string.at(a) == " ", or

            in_string.at(a) == ".", or

            in_string.at(a) == ",", or

            in_string.at(a) == "?";

        then

            return b

        end if

        (a = a + 1);

        (b = b +in_string.at(a));

}      

    end loop

end function

I don’t know where else to turn for help.
Besides these examples, can you recommend where to find help?

Thank you,
DPinck

Hi @DPinck.
First of all I don’t know pseudo script but I think I know what you are trying to do, let me know if I’m right please.
This is your code:

function do_something(in_string){

    (let a = 1; b = "");

    for

        if  in_string.at(a) == " ", or

            in_string.at(a) == ".", or

            in_string.at(a) == ",", or

            in_string.at(a) == "?";

        then

            return b

        end if

I think it should be like this:

function do_something(in_string){
// Initialicing the variables
    let a = 1, b = "";

    for(let a=0; a<in_string.lenght; a++){
// the || is or 
//chartAt is a method that returns a char of a String in a specified position
        if  ((in_string.charAt(a)== "") || (in_string.charAt(a)== ".")|| (in_string.charAt(a)== ",") || (in_string.charAt(a)== "?") ){
//In casein_string is "" or , or . or ?; b will be return
              return b;
        }
     }
// "a" will be return if the condition in the loop is false
     return a;
}

1 Like

Having us rewrite your code for you isn’t really helpful. It doesn’t really help you learn at all.

It is much more helpful if you describe what your code is trying to do, what errors you are having, and where you got stuck with those errors.

Going through the process of describing where you got stuck 1) help us help you, 2) is important for all programmers, and 3) sometimes gets you un-stuck!

3 Likes

I completely agree with you, you make sense. I started off learning pseudo code, then began learning Java. As I understand, they are similar. my problem is figuring out what the correct syntax is in Java when converting my pseudo codes into Javascript.

Thank you.

Java or Javascript? They are very different languages.

Have you gone through the FreeCodeCamp Javascript lessons?

1 Like

Thank you,
I’m reading through your suggestion and figuring out the logic in what you sent.
I really appreciate your input.
Best,
DPinck

1 Like

Thankyou JeremyLT,
Javascript. I honestly didn’t know they were different, but in fact a short lingo of the whole JS. No I haven’t gone through all Javascript lessons, I am in a beginner one which has been enightening, but obviously not to the point of answering my questions yet.
I appreciate your question and will be looking into more lessons.

“Pseudo code” is a helpful tool for planning out your logic without worrying about language syntax. I think it’s great that you’ve taken some time to focus on logic first. As far as learning how to write your solution in real code, I suggest that you don’t think of it as learning to “translate” from pseudo code to real code. It sounds like you would get the most benefit out of going through JavaScript lessons. As you learn more and more JavaScript you can look at the things that you pseudo coded and see if you know how to write it as real code yet. This can give you some additional challenges to practice your skills, in addition to the challenges in the curriculum.

2 Likes

Hi ArielLeslie,

Thank you so much for your reply and I really appreciate your insight into my issues. I am an older learner and late to the process of learning code. I feel like I’m on the cusp of understanding Javascript, then on to HTML, CSS and everything from there. Do you have any suggestions on Javascript lessons? or are all the lessons available fairly similar? I did start one of the beginner’s courses already and I’m getting a lot from it>

Sorry I couldn’t get back to you til now. I had a really rough yesterday and morning today.

Thanks again,
Doug

Well, this is a freeCodeCamp forum so I’m sure it’s not a surprise that I recommend starting with freeCodeCamp.org. The early introduction to syntax is probably going to be pretty similar in most education paths, but I really do think that freeCodeCamp is the best free resource out there (especially because it has the best community).

1 Like

Ariel,

I like your sense of humor! LOL Yes, I wasn’t asking about outside FCC, I have already been getting the sense of a great community here. I was meaning that I found many beginner courses and all of them ranging from a small amount of time to several days worth. The course I’m currently in is a 6 hr course. I was just asking if you had any recommendations of certain beginner courses from FCC, or just take however many I need to in order to build confidence?

Thank you again for your quick replies…I appreciate it,
Doug

freeCodeCamp is a single curriculum that is intended to be done in order (although the Python stuff is a bit of a sidequest). You are welcome to jump in wherever you want, but I would suggest either starting at the beginning, or starting with JavaScript if you are already very comfortable with html and css.

1 Like

Hi Ariel,

I didn’t know there was a course like you have said here, I thought you were talking about all the videos available tghrough FCC.

I’m really glad I asked.
Thank you,

Doug

freeCodeCamp has a lot of great material on YouTube and in article form, but the core of freeCodeCamp is the interactive curriculum.

Hi Ariel,

Thank you and I really appreciate your help and direction. I’ve already started the curriculum you suggested.

I hope one day I’ll know code well enough to help others.

Best,
Doug

You’ll be surprised how quickly you’ll be able to help others who are a little earlier in their journey than you are.

Happy coding!