I learn English by using ChatGpt at latest

背景

今、ChatGptを使った英語学習がいい感じになる、とチームで話題になっています。
そこで、業務に出てきた調べ物をChatGptに英語で聞いてみたところ結構勉強になりました。 その時の質問に関してまとめました

(練習のために今回は英語で書きました)

use chatgpt to improve English skill

I learn English by using ChatGpt at latest.
There's something I don't understand, then I send English message to ChatGpt.
By doing so, I think improve my English skill.
I will introduce question to ChatGpt.

about method name

I am thinking about method name. this method decide whether to display the other component. do you have good idea?

ChatGpt return suggested method name.

isComponentVisible()
shouldRenderComponent()
displayComponentIf()
determineComponentVisibility()
showComponentWhen()
checkComponentVisibility()
allowComponentDisplay()

about jest

How to check whether return null from react component using by  jest

ChatGpt return jest method and sample code.

import React from 'react';
import { render } from '@testing-library/react';
import MyComponent from './MyComponent';

describe('MyComponent', () => {
  it('should return null', () => {
    const { container } = render(<MyComponent />);
    expect(container.firstChild).toBeNull();
  });
});

about Markdown

I want to make table that is maked markdown.
first columns is  name.
second columns is  age,
and thierd column is  birthday.
If you can make above markdown table.
please insert  three sample data.

ChatGpt return markdown table with sample data.

| Name      | Age | Birthday    |
|-----------|-----|-------------|
| John      | 30  | 1993-05-15  |
| Sarah     | 25  | 1998-12-10  |
| Michael   | 28  | 1995-09-22  |

about golng sorce code

Please make below program used by golang.
1: get current DateTime.
2: convert format to YYYY/MM/DD
3: convert result of 2 to string type.
4: return result of 3 and  result that is error.

please define method.

ChatGpt return golang sorce code.

package main

import (
    "fmt"
    "time"
)

// Define a method to get the current DateTime and format it as "YYYY/MM/DD"
func formatCurrentDateTime() (string, error) {
    currentTime := time.Now()
    formattedTime := currentTime.Format("2006/01/02")

    return formattedTime, nil
}

func main() {
    // Call the method to get and format the current DateTime
    result, err := formatCurrentDateTime()

    if err != nil {
        fmt.Println("An error occurred:", err)
        return
    }

    fmt.Println("Formatted DateTime:", result)
}

about SQL query

I want to know that how to get columns name from mysql db, can you create sql query?

ChatGpt return SQL query, but it contains unnecessary data, so I heard again.

If possible, I want to get only column name, this sql query result contains unnecessary data.

ChatGpt return Improved SQL query.

SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'your_table_name';

conclusion

It is difficult to experience that write English in Japanese work environment.
By using ChatGpt during working, You can gain experience in writing skill .
I want to continue this learning method.
It seems that ChatGpt also can understand voice message.
So I want to practice speaking.