const
declarations for variables that are never reassigned JS-024288 }
89 StreamingClient.mockImplementation(() => mockStreamingclient)
90 let url = 'http://localhost:9009'
91 let message = () => {}92
93 const connection = new SocketConnection(url, message, jest.fn)
94
87 stopStreaming: jest.fn(),
88 }
89 StreamingClient.mockImplementation(() => mockStreamingclient)
90 let url = 'http://localhost:9009'91 let message = () => {}
92
93 const connection = new SocketConnection(url, message, jest.fn)
61 let url = 'http://localhost:9009'
62 let message = () => {}
63 let onSocketConnection: boolean
64 let isConnect = (isConnect: boolean) => {65 onSocketConnection = isConnect
66 }
67 const connection = new SocketConnection(url, message, isConnect)
58 stopStreaming: jest.fn(),
59 }
60 StreamingClient.mockImplementation(() => mockStreamingclient)
61 let url = 'http://localhost:9009'62 let message = () => {}
63 let onSocketConnection: boolean
64 let isConnect = (isConnect: boolean) => {
59 }
60 StreamingClient.mockImplementation(() => mockStreamingclient)
61 let url = 'http://localhost:9009'
62 let message = () => {}63 let onSocketConnection: boolean
64 let isConnect = (isConnect: boolean) => {
65 onSocketConnection = isConnect
Variables that are never re-assigned a new value after their initial declaration should be declared with the const
keyword.
This prevents the programmer from erroneously re-assigning to a read-only variable, and informs those reading the code that a variable is a constant value.
let pi = Math.PI
for (let x of xs) {
use(x);
}
let { a, b } = object;
use(a, b);
const pi = Math.PI
for (const x of xs) {
use(x);
}
const { a, b } = object;
use(a, b);